I'm using dxGrid in a xamarin application to display contents. This works well so far, but I can't get the grid to update values.
I'm using this grid:
<dxGrid:GridControl
x:Name="grid"
ItemsSource="{Binding articles, Mode=TwoWay}"
SelectedDataObject="{Binding selectedRowObject}"
AutoFilterPanelVisibility="true"
IsReadOnly="true"
SortMode="Multiple">
<dxGrid:GridControl.Columns>
<dxGrid:TextColumn
FieldName="description"
Caption = "Description"
AutoFilterCondition="Contains"/>
<dxGrid:TextColumn
FieldName="id"
Caption = "ID"
AutoFilterCondition="Contains"/>
<dxGrid:TextColumn
FieldName="formattedPrice"
Caption = "Price"
AutoFilterCondition="Contains"/>
</dxGrid:GridControl.Columns>
</dxGrid:GridControl>
In my ViewModel, I use this for the databinding:
public List<Article> articles
{
get
{
return dataItem.articles;
}
}
The dataItem object contains a list of articles besides some other general information. When I open the page, the contents show up correctly, but when I'd like to be able to do this manually. For example, this does not work when I'm returning to the oage via Navigation.PopAsync();
.
To reload the list, I use PropertyChanged(this, new PropertyChangedEventArgs(nameof(articles)));
, the pendant of this works for all other elements but the grid. The items of the articles-object are correctly set though when I check them in the debugger, they are just not updating.
I found a quick fix that works for me (altough it looks kind of unclean):
In the code-behind of the view: