How to Enlarge Spaces Between GridView Elements in Windows 8

How to increase the space between the elements GridViewin Windows 8?

+5
source share
5 answers
<GridView.ItemContainerStyle>
   <Style TargetType="FrameworkElement">
      <Setter Property="Margin" Value="0 0 20 20"/>
   </Style>
</GridView.ItemContainerStyle>
+15
source

I'm not sure I understand your expression ...

If we use the field for the interval, we can see the space between but when we select any objects, the selection background will cover the space between the elements.

... since I just add Margin (say Margin = "10") only to the FIRST GridViewItem , and all subsequent elements are evenly distributed.

code snippet -

        ... <GridView>
            <GridViewItem Margin="20" Width="100" Height="100">
                <Image Source="Assets/SmallLogo.png"/>
            </GridViewItem> ...
0
source

ItemContainerStyle. Blend , " " → " ". OuterContainer.

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>
0
source

Create an ItemTemplate and use margin for each item in it. This way you can distribute them

-1
source

All Articles