Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Order items horizontal in XAML GridView (Win8 / Metro)

how can i sort the items of GridView horizontal in the XAML? Sadly i found no method to achieve this. The Keyword "Orientation" is not available. Here is my current GridView:

            <GridView x:Name="TestDataBinding"
                HorizontalContentAlignment="Left"
                VerticalContentAlignment="Top"
                SelectionMode="None"
                ItemsSource="{Binding}"
                ItemTemplateSelector="{StaticResource itemTemplateSelector}"
                Margin="0,60,0,0"
                Width="1100" Height="540"
            />

Another Way could be a "VariableSizedWrapGrid". But this can't be used for creating Items through "ItemsSource" (and ItemTemplateSelector).

like image 649
serious Avatar asked Dec 01 '22 20:12

serious


1 Answers

Sorry, I have to take issue with your comment that this cannot be done with a VariableSizedWrapGrid. It most certainly can:

<GridView>
    <GridView.ItemsPanel>
        <ItemsPanelTemplate>
            <VariableSizedWrapGrid Orientation="Horizontal" />
        </ItemsPanelTemplate>
    </GridView.ItemsPanel>
    <x:String>One</x:String>
    <x:String>Two</x:String>
    <x:String>Three</x:String>
    <x:String>Four</x:String>
</GridView>

And I have to take issue that VariableSizedWrapGrid cannot be used for creating items through ItemsSource. It most certainly can. WrapGrid and VariableSizedWrapGrid are fundamentally identical. WrapGrid is slightly lighter weight since it does not support Column and Row spanning.

like image 66
Jerry Nixon Avatar answered Dec 18 '22 01:12

Jerry Nixon