ListView does not update properly
Posted: 14 Sep 2017, 11:31
I have a ListView like this:
The DeleteCommand removes an element from the underlying MPValues collection and notifies that the MPValues property has changed.
I have confirmed that the element gets deleted correctly.
However, the change in the ListView does not show up until I navigate away from the ListView and then back again.
How can I force a redraw of the ListView so that the changes show up for the user immediately after the change has happened?
I have seen ListView.Items.Refresh(); used in WPF applications, but that does not seem to work here.
Code: Select all
<ListView ItemsSource="{Binding MPValues}" >
<ListView.View>
<GridView>
<GridViewColumn Header="#" DisplayMemberBinding="{Binding LiteralIndex}"/>
<GridViewColumn >
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Command="{Binding Path=DataContext.DeleteCommand, ElementName=DetailsController}" CommandParameter="{Binding LiteralIndex}" Content="Delete" >
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>I have confirmed that the element gets deleted correctly.
However, the change in the ListView does not show up until I navigate away from the ListView and then back again.
How can I force a redraw of the ListView so that the changes show up for the user immediately after the change has happened?
I have seen ListView.Items.Refresh(); used in WPF applications, but that does not seem to work here.