theEternalStudent
theEternalStudent

Reputation: 74

How can I implement a table-like control for windows phone?

I am looking to design a time table, where the first row and first column act as headers. The control should support both horizontal swipe and vertical scroll and the contents of the cell should change as per its row/column position when scrolled horizontally or vertically.

Upvotes: 1

Views: 432

Answers (1)

Rovshan Mamedov
Rovshan Mamedov

Reputation: 268

Here is your XAML:

<phone:LongListSelector ItemsSource="{Binding}">
    <phone:LongListSelector.ItemTemplate>
        <DataTemplate>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="4*"/>
                    <ColumnDefinition Width="1*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Text="{Binding Item}" TextWrapping="Wrap" Grid.Column="0"/>
                <TextBlock Text="{Binding Qty}" Grid.Column="1"/>
            </Grid>
        </DataTemplate>
    </phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>

Now here you bind ViewModel to ItemSource. And inside data Template you bind fields of table.

Upvotes: 1

Related Questions