James
James

Reputation: 2610

item orientation in wrapgrid in windows8

I use a wrapgrid as the itemspaneltemplate in my app

<GridView x:Name="InfoGridView" Margin="50">
            <GridView.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapGrid Orientation="Vertical" ItemWidth="200" ItemHeight="50"  Height="400" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                </ItemsPanelTemplate>
            </GridView.ItemsPanel>
            <TextBlock Text="Name" Style="{StaticResource AppNameTextStyle}" />
            <TextBox x:Name="NameTextBox" Width="180"/>
            <Button x:Name="AnotherNameButton"  Style="{StaticResource AddAppBarButtonStyle}"/>
        </GridView>

The TextBlock, TextBox and the Button are display in the middle of the item, how to let them display keep left?

Upvotes: 0

Views: 894

Answers (1)

Jim O&#39;Neil
Jim O&#39;Neil

Reputation: 23764

Set this up on the ItemContainerStyle within your GridView by adding the following XAML below your ItemsPanel entry.

        <GridView.ItemContainerStyle>
            <Style TargetType="GridViewItem">
                <Setter Property="HorizontalContentAlignment" Value="Left" />
            </Style>
        </GridView.ItemContainerStyle>

Upvotes: 4

Related Questions