Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ItemInvoked vs SelectionChanged

In Windows UWP, what is the difference between the ItemInvoked and SelectionChanged events for a NavigationView? The API reference states

ItemInvoked
Occurs when an item in the menu receives an interaction such as a click or tap.

SelectionChanged
Occurs when the currently selected item changes.

It seems to me that SelectionChanged can detect when navigation occurs even by some method other than clicking a NavigationView.MenuItem, so would be the better, more encompassing option to use?

Or are there different use cases for each?

like image 295
binaryfunt Avatar asked Mar 13 '26 16:03

binaryfunt


1 Answers

The main difference would be that the SelectionChanged event is executed only once, but if you click the selected item repeatedly, it is not fired. ItemInvoked on the other hand will execute each time an item is clicked even if it is selected already.

Also - SelectionChanged event will execute when you manually set SelectedItem in code.

like image 183
Martin Zikmund Avatar answered Mar 15 '26 04:03

Martin Zikmund



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!