I'd like to add GridView
to my page so that the first group has a 120px
left margin. If I set the left margin property on the GridView
it does give me the right margin, but when I scroll the groups the groups are clipped to the left of this margin. Is there a way to set the GridView
margin without clipping? What I did now is add a fake group that is empty. But now when I go to snapped view, I have a hard time to get this group to take up no space, even when the item template that I use in this fake group is just
<Grid></Grid>
I guess I could try to edit the GroupStyle and make the spacing between groups 0 (I would accept this as an answer as well) although this seems very ugly.
VS2012's reference implementation of a Windows Store "Grid App" accomplishes this by the use of the Padding attribute on the GridView:
<GridView
x:Name="itemGridView"
AutomationProperties.AutomationId="ItemGridView"
AutomationProperties.Name="Grouped Items"
Grid.RowSpan="2"
Padding="116,137,40,46"
ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}"
ItemTemplate="{StaticResource Standard250x250ItemTemplate}"
SelectionMode="None"
IsSwipeEnabled="false"
IsItemClickEnabled="True"
ItemClick="ItemView_ItemClick">
The snapped VisualState can be used to change the Padding value to something appropriate:
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="itemGridView" Storyboard.TargetProperty="Padding">
<DiscreteObjectKeyFrame KeyTime="0" Value="0,0,0,0"/>
</ObjectAnimationUsingKeyFrames>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.