GridView控件(Windows 8)呈现错误

时间:2012-11-05 15:14:21

标签: xaml gridview windows-8 winrt-xaml

这是我使用的GridView控件的代码(在BlankPage App上制作):

<GridView HorizontalAlignment="Left" x:Name="gridView1" Margin="227,220,0,53" Width="1087">

        <Button x:Name="XboxButton" Margin="10,10,10,10" Style="{StaticResource XboxButton}" Height="200" Click="SnappedXboxButton_Click_1"/>
        <Button x:Name="PS3Button" Margin="10,10,10,10" Style="{StaticResource PS3Button}" Click="SnappedPS3Button_Click_1" />
        <Button x:Name="PCButton" Margin="10,10,10,10" Style="{StaticResource PCButton}" Click="SnappedPCButton_Click_1" />
        <Button x:Name="DSButton" Margin="10,10,10,10" Style="{StaticResource DSButton}" Click="SnappedDSButton_Click_1" />
        <Button x:Name="PSPButton" Margin="10,10,10,10" Style="{StaticResource PSPButton}" Click="SnappedPSPButton_Click_1" />
        <Button x:Name="ContactButton1" Margin="10,10,10,10" Style="{StaticResource ContactButton}" Click="SnappedContactButton_Click_1" />
        <Button x:Name="PrivacyButton" Margin="10,10,10,10" Style="{StaticResource DisclaimerButton}" Click="SnappedPrivacyButton_Click_1"/>


    </GridView>

问题是当应用程序首次加载时,显示GridView显示如下:

(请到这里,因为,我是新的,我不允许发布图片)

http://social.msdn.microsoft.com/Forums/getfile/189014

但是当我点击任何项目并返回第一页时,渲染效果很好,如下图所示:

http://social.msdn.microsoft.com/Forums/getfile/189015

1 个答案:

答案 0 :(得分:0)

改善旅游加价。 1.在GridView中为按钮定义样式资源,或者在app资源中创建基本样式,然后使用BasedOn = {StaticResource binding notation在每个按钮样式中使用它 2.设置边距,宽度,高度,因为我看到所有按钮都具有相同的属性值 3.您不希望GridView自动设置宽度或高度值,确保您设置样式中的值