0

Im trying to use the AdaptiveGridView as a main menu to navigate to other pages so I thought I'd test a click event on it, from my understanding of the sample repo that can be found below you can use a clicked event when click is enabled to do something depending on the item clicked:

https://github.com/Microsoft/UWPCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/AdaptiveGridView

Seems straight forward but when I try trigger the click event in my own code nothing happens when a popup should appear.

C# Click Event:

private async void AGVC_ItemClick(object sender, Windows.UI.Xaml.Controls.ItemClickEventArgs e)
        {
                await new MessageDialog($"You clicked {(e.ClickedItem as AdaptItem).Title}", "Item Clicked").ShowAsync();
        }

The grid in my XAML page:

<Controls:AdaptiveGridView Name="AGVC"
                                   OneRowModeEnabled="False"
                                   ItemHeight="200"
                                   DesiredWidth="200"
                                   SelectionMode="Single"
                                   IsItemClickEnabled="True"
                                   VerticalAlignment="Top"
                                   ItemTemplate="{StaticResource MenuTemplate}" HorizontalAlignment="Left"/>
                <StackPanel VerticalAlignment="Bottom" Margin="0,24,0,0" Grid.Row="1" Background="{ThemeResource SystemControlBackgroundAccentBrush}">
UWP122
  • 39
  • 7

1 Answers1

0

Item clicked was missing from the AdaptiveGridView

<Controls:AdaptiveGridView Name="AGVC"
                                   OneRowModeEnabled="False"
                                   ItemHeight="200"
                                   DesiredWidth="200"
                                   SelectionMode="Single"
                                   IsItemClickEnabled="True"
                                   VerticalAlignment="Top"
                                   ItemClick="AGVC_ItemClick"
                                   ItemTemplate="{StaticResource MenuTemplate}" HorizontalAlignment="Left" />
UWP122
  • 39
  • 7