Monday, May 13, 2013

A simple table in Windows Store App

Hi friends, a table or datagrid is deprecated in Windows 8 App but I desperately needed that in my app. The GridView control in Windows App does not have notion of Rows or Columns and neither does a ListView.

However I have created a simple table using a ListView and have hardcoded the List Items. Will be doing it dynamically soon.

Here goes my XAML code.

<ListView Grid.Row="0" HorizontalAlignment="Center" Width="300" Margin="0,20,0,0 ">
            <ListViewItem>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Width="150">Apple</TextBlock>
                    <TextBlock>100</TextBlock>
                </StackPanel>
            </ListViewItem>
            <ListViewItem>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Width="150">Banana</TextBlock>
                    <TextBlock>2000</TextBlock>
                </StackPanel>
            </ListViewItem>
            <ListViewItem>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Width="150">Oranges</TextBlock>
                    <TextBlock>1500</TextBlock>
                </StackPanel>
            </ListViewItem>           
        </ListView>

And here is how it looks like.

No comments:

Post a Comment