I would like to change selectedItem only 1 way from viewModel to View and I expect SelectionChanging or/and SelectionChanged events are fired.
<sfListView:SfListView x:Name="list" ItemsSource="{Binding Items}" SelectionMode="Single" SelectionGesture="Tap"
ItemSpacing="2" AllowSwiping="False" SelectionChanging="list_SelectionChanging" SelectionBackgroundColor="Yellow" Orientation="Horizontal"
SelectedItem="{Binding SelectedItem, Mode=OneWay}" >
When I raise RaisePropertyChanged("SelectedItem"); in ViewModel, it works fine, I can see selectedItem is changed but I want to scroll to the selectedItem, Thats why I tried SelectionChanging or SelectionChanged events but not luck. they arent fired. they are fired only when I tap on an item. What is the reason for that? How can I achieve my purpose? I need to scroll to selecteditem but selecteditem should be set in the ViewModel
private void list_SelectionChanging(object sender, Syncfusion.ListView.XForms.ItemSelectionChangingEventArgs e)
{
try
{
(list.LayoutManager as Syncfusion.ListView.XForms.LinearLayout).ScrollToRowIndex(vm.SelectedItem.DisplayOrder);
}
catch (Exception ex)
{
}
}