locked
Need to work out what event is associated to this RRS feed

  • Question

  • hi,

    in the onnavigated event i am creating a handful of items and binding to the ItemsGridView object

    I want to know what event is associated to what i have done in image below(clicking on the row/highlight the entire row), and what ui element is it associated with?

    here is the xaml

    <StackPanel Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
            <GridView x:Name="ItemsGridView" >
                <GridView.ItemTemplate>
                    <DataTemplate>
                        <Grid >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Margin="10" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Text="Hello World"/>
                            <TextBlock Margin="10" Grid.Row="0" Grid.Column="2" VerticalAlignment="Center" Text="GoodBye World"/>
                            </Grid>
                    </DataTemplate>
                </GridView.ItemTemplate>
                <GridView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VariableSizedWrapGrid Orientation="Vertical" />
                    </ItemsPanelTemplate>
                </GridView.ItemsPanel>
            </GridView>
        </StackPanel>

    Monday, October 28, 2013 4:32 AM

Answers

  • Depending how GridView is configured we can use either of these events ItemClick (in case IsItemClickEnabled is set to true) or SelectionChanged event.  ClickedItem in case of ItemClick will give us item clicked whereas in case of SelectionChanged event, last item in  AddedItems collection will give us selected item. 

    Thanks, Sachin

    • Marked as answer by c.j.mcnaught Monday, October 28, 2013 9:43 PM
    Monday, October 28, 2013 3:42 PM

All replies

  • Depending how GridView is configured we can use either of these events ItemClick (in case IsItemClickEnabled is set to true) or SelectionChanged event.  ClickedItem in case of ItemClick will give us item clicked whereas in case of SelectionChanged event, last item in  AddedItems collection will give us selected item. 

    Thanks, Sachin

    • Marked as answer by c.j.mcnaught Monday, October 28, 2013 9:43 PM
    Monday, October 28, 2013 3:42 PM
  • Thanks Sachin, the SelectionChanged was the one i am after
    Monday, October 28, 2013 9:43 PM