Hi,
I dont know if this is an intended behavior. it might even makes sense but I just verified with ListView of Xamarin.Forms and there I dont have same behavior.
I have my simple SfDatagrid as below
<AbsoluteLayout x:Name="programAbsolute" BackgroundColor="#ADD8E6" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" >
<StackLayout AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All">
<SearchBar Placeholder="Program name" />
<sfgrid:SfDataGrid ScrollingMode="PixelLine" x:Name="dataGrid" AutoGenerateColumns="False" AllowSorting="True" AllowDraggingColumn="True" AllowDraggingRow="True"
ColumnSizer="Star"
RowHeight="153" AllowSwiping="True" SelectionMode="Single" ItemsSource="{Binding AllPrograms}"
SelectedItem="{Binding SelectedItem}">
everything works fine all bindings are good but when I repopulate my AllPrograms binding object and Raise property changed on this object, it fires selecteditem changed as value= null.
I tested with ListView from xamarin.forms, it doesnt happen. Am I doing something wrong or missing?
public ObservableCollection<Program> AllPrograms { get; set; }
private Program selectedItem;
public Program SelectedItem
{
get { return selectedItem; }
set
{
if (value != null)
{
selectedItem = value;
RaisePropertyChanged("SelectedItem");
}
}
}
protected async Task GetData()
{
var DbPrograms = await db.GetAllPrograms_async();
AllPrograms = new ObservableCollection<Database.Model.Program>(DbPrograms);
RaisePropertyChanged("AllPrograms");
}