2010-12-23 34 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属性。
  • 避免使用这些丑陋的边距。通常设计师生成它们。确保清理它们。
  • 避免将明确的高度/宽度分配给单个项目。