8

如何增加GridViewWindows 8 中 a 项之间的间距?

4

5 回答 5

20
<GridView.ItemContainerStyle>
   <Style TargetType="FrameworkElement">
      <Setter Property="Margin" Value="0 0 20 20"/>
   </Style>
</GridView.ItemContainerStyle>
于 2013-02-25T21:20:52.467 回答
0

您可以为 ItemContainerStyle 提供边距。在 Blend 中,右键单击您的网格,选择编辑 Additional Template -> Edit Generated Item Container。给 OuterContainer 组件适当的边距。

于 2012-11-19T23:05:24.417 回答
0

我不确定我是否理解你的陈述...

如果我们使用边距作为间距,我们可以看到项目之间的空间,但是当我们选择任何项目时,选择背景将覆盖项目之间的空间。

...因为我只是将Margin(比如 Margin="10")添加到FIRST GridViewItem并且所有后续项目都是均匀分布的。

代码片段-

        ... <GridView>
            <GridViewItem Margin="20" Width="100" Height="100">
                <Image Source="Assets/SmallLogo.png"/>
            </GridViewItem> ...
于 2012-09-23T18:58:54.240 回答
0

为 GridViewItem 使用边距。

例如,

<Style x:Key="GridViewItemStyle1" TargetType="GridViewItem">
    <Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}"/>
    <Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}"/>
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="TabNavigation" Value="Local"/>
    <Setter Property="IsHoldingEnabled" Value="True"/>
    <Setter Property="Margin" Value="0,-10,0,0"/> <!-- here -->
    <Setter Property="BorderThickness" Value="0,0,2,0" /> <!-- border-right, show infinity each items.-->
    <Setter Property="BorderBrush" Value="Green" />

    <Setter Property="Template">
    ...
</STyle>
于 2014-01-08T09:19:17.257 回答
-1

创建 ItemTemplate 并在其中为每个项目使用 Margin。这样你就可以把它们散开

于 2012-09-11T16:15:07.597 回答