I bind some values to WPF listview.I want to remove or hide some row when click or select in row.I m try to do this one as follow.
listview.Items.RemoveAt(listview.Items.IndexOf(listview.SelectedItem));
but it’s get exception.how to do this one? please help me……
You can use MVVM pattern to achive it. You will need to create ObservableCollection, and then you can write command, wich will initialize with its collection, and when it should execute, it recieve object you need to delete via
{Binding}. Its look like this:RemoveItemCommand – is templated class which implements ICommand interface
then, your view will contain something like this^