dimanche 10 mai 2015

how do I have grid in listview?

I want to use list-view in xaml but want it to look like a grid not typical list. The whole screen is to be made of squares. I tried to make it but something is not working:( Here is what I have:

<Grid>
    <ListView Background="Blue">
     <ListView.ItemTemplate>
            <DataTemplate>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Rectangle x:Name="rectangle" Fill="Beige" Grid.Column="0" Grid.Row="2"
                           HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                           />
            </Grid>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

</Grid>
</Page>

What is it I'm doing wrong?

Aucun commentaire:

Enregistrer un commentaire