The first time the View is loaded, the item in the ListView is not selected in UI (although it is selected in the ViewModel), but if I refresh, the item is selected in UI view. I am having this problem only in Android, in iOS is working fine.
XAML code:
<ListView ItemsSource="{Binding SalesPersons}"
SelectedItem="{Binding SelectedSalesPerson, Mode=TwoWay}" IsPullToRefreshEnabled="True"
RefreshCommand="{Binding UpdateSalesPersonsCommand}" IsRefreshing="{Binding IsLoadingList}">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell TextColor="{StaticResource DarkColor}" Text="{Binding Name}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
ViewModel code:
public SalesPerson SelectedSalesPerson
{
get
{
return _selectedSalesPerson;
}
set
{
_selectedSalesPerson = value;
base.OnPropertyChanged("SelectedSalesPerson");
}
}
This possible bug is happening only in Android when I set the ItemsSource field the first time. If I refresh it works. Howecer, in iOS is working fine always.
Somebody know something about this?