2010-12-23 54 views
0

我無法看到所有三個buttons.Only第一個按鈕是visible.Following是代碼:裹面板:不能顯示多個按鈕

<Grid x:Name="LayoutRoot" Background="Transparent"> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="Auto"/> 
     <RowDefinition Height="*"/> 
    </Grid.RowDefinitions> 

    <!--TitlePanel contains the name of the application and page title--> 


    <Image Name="Title_image" Stretch="Uniform" Source="Title.png" Margin="0,0,0,60" Grid.Row="1" Visibility="Visible" /> 

    <!--ContentPanel - place additional content here--> 
    <toolkit:WrapPanel Name="empty" Orientation="Horizontal" Grid.Row="1" > 
     <Button Margin="0,695,336,-13" Click="On_PhotoClick" Height="83" Width="124"> 
      <StackPanel Orientation="Vertical"> 
       <Image Source="ic_right.png" Height="23" Width="53" /> 
       <TextBlock Text=" Photo" Height="27" FontSize="17" Width="67" /> 
      </StackPanel> 
     </Button> 
     <Button Margin="179,702,170,-13" BorderBrush="#FF867F7F" Background="#009A8E8E" > 
      <StackPanel Orientation="Vertical"> 
       <Image Source="icon_list_a.png" /> 
       <TextBlock Text=" List" Height="33" FontSize="20" /> 
      </StackPanel> 
     </Button> 
     <Button Margin="367,702,-12,-13" > 
      <StackPanel Orientation="Vertical"> 
       <Image Source="icon_list_a.png" /> 
       <TextBlock Text="Information" Height="33" FontSize="20"/> 
      </StackPanel> 
     </Button> 
    </toolkit:WrapPanel> 
</Grid> 

可有一個建議可能是什麼問題

+2

什麼是這些醜陋的利潤率?你嘗試刪除它們嗎? – decyclone 2010-12-23 06:37:07

回答

0

組的高度和寬度圖像內StackPanels

<Image Source="ic_right.png" Height="23" Width="53" /> 
1

然後,你需要這樣的事:

<Grid x:Name="LayoutRoot" 
     Background="Transparent"> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="Auto" /> 
     <RowDefinition Height="*" /> 
    </Grid.RowDefinitions> 
    <!--TitlePanel contains the name of the application and page title--> 
    <Image Name="Title_image" 
      Stretch="Uniform" 
      Source="Title.png" 
      Grid.Row="0" 
      Visibility="Visible" /> 
    <!--ContentPanel - place additional content here--> 
    <toolkit:WrapPanel Name="empty" 
         Orientation="Horizontal" 
         Grid.Row="1" 
         ItemWidth="128" 
         ItemHeight="128"> 
     <Button Click="On_PhotoClick"> 
      <StackPanel Orientation="Vertical"> 
       <Image Source="ic_right.png" /> 
       <TextBlock Text="Photo" 
          FontSize="20" /> 
      </StackPanel> 
     </Button> 
     <Button> 
      <StackPanel Orientation="Vertical"> 
       <Image Source="icon_list_a.png" /> 
       <TextBlock Text=" List" 
          FontSize="20" /> 
      </StackPanel> 
     </Button> 
     <Button> 
      <StackPanel Orientation="Vertical"> 
       <Image Source="icon_list_a.png" /> 
       <TextBlock Text="Information" 
          FontSize="20" /> 
      </StackPanel> 
     </Button> 
    </toolkit:WrapPanel> 
</Grid> 

注意事項:

  • 首圖有錯Grid.Row。 (它是1(第二行),應該是0(第一行))
  • 要分配統一的高度/寬度,請使用WrapPanel的ItemHeight/ItemWidth屬性。
  • 避免使用這些醜陋的邊距。通常設計師生成它們。確保清理它們。
  • 避免將明確的高度/寬度分配給單個項目。
相關問題