When selecting the navigationview settings item ItemInvoked eventhandler is not fired on Android
When selecting the navigationview settings item ItemInvoked eventhandler should be fired on Android as it does on Windows/UWP
In shared projects mainpage.xaml paste in this:
<Grid>
<NavigationView x:Name="NavigationViewControl" PaneDisplayMode="Auto" IsSettingsVisible="True" ItemInvoked="OnItemInvoked">
<NavigationView.MenuItems>
<NavigationViewItem Content="First Item" x:Name="A" Icon="Accept"/>
<NavigationViewItem Content="Second Item" x:Name="B" Icon="Save" />
<NavigationViewItem Content="Third Item" x:Name="C" Icon="Calendar"/>
</NavigationView.MenuItems>
</NavigationView>
</Grid>
In mainpage.cs paste in ths:
private void OnItemInvoked(object sender, NavigationViewItemInvokedEventArgs args)
{}
Nuget Package:
Uno.UI 1.45.0
Package Version(s):
Affected platform(s):
Visual Studio
Relevant plugins
I have a similar issue (#2418).
The item only changes selection when the left-side hook (the SelectionIndicator element, area about 2mm on the left side of the selected NavigationViewItem).
This issue also occurs in the WASM head.
I'm willing to work on the issue, but I'd need some guidance on how to tackle platform specific issues, since the control renders just fine on UWP.
It might be the ZIndex that's avoiding mouse point capture.
BTW, I faced the issue on Android and WASM, don't know about iOS (don't own a device).
@weitzhandler thanks for that! It's actually an issue that is in both Selector, ListView and ListViewItem, for which changing the ListViewItem.IsSelected property does not do anything, and it breaks navigation, I'll revalidate with your sample to make sure it fixes the issue correctly.
Something that might be worth noticing though, I tried hooking up the ItemInvoked event, which was never fired.
Thanks for that, I'll make sure to check it.
@weitzhandler the issue you're having is actually https://github.com/unoplatform/uno/issues/2477, for which providing a DataTemplate of the type of the Item container (NavigationViewItem in this case) is properly supported by ListView control.
https://github.com/unoplatform/uno/pull/2462 will partially adress the issue you mentioned with the ItemsSource, but will not show the current selection. The original issue mentioned at the top is fixed by https://github.com/unoplatform/uno/pull/2462.
Thanks @jeromelaban!
Most helpful comment
Here's a branch in my fork of Uno. It contains a UI test that reproduces the issue.