The standard pattern to disable highlighting of the selected row in a ListView is to set the SelectedItem property to null inside the ItemSelected event handler.
This worked fine on all platforms up to 2.4.0.280 but in 2.5.0 this no longer works for UWP. It works fine for Android and iOS
The row should not be selected
The row is selected for UWP apps.
It works fine on Android and iOS
Test project is attached: App1.zip
Note: When not defining an event handler for ItemSelected, setting the SelectedItem to null works as expected. However, once the event is fired once, setting ItemSelected to null outside the event handler stops working as well.
This used to work correctly in a previous release
As a work around try Device.BeginInvokeOnMainThread(()=>ListView.SelectedItem = null);
Probably related to #1133 or #1157.
using the Dispatcher workaround to set the SelectedItem to null works in my case.
Just a guess but... Xamarin doesn't handle binding to null
at all. Unlike WPF. I would try setting the SelectedIndex
property to -1. That should cause a trickle-down effect of making nothing selected in the
ListViewwith the result being that
SelectedItem` will eventually be set to null - IE: It would become the affect instead of the cause, of all the action.
Most helpful comment
As a work around try Device.BeginInvokeOnMainThread(()=>ListView.SelectedItem = null);