Please use ObservableCollection
to replace List
, WPF provides the ObservableCollection<T> class, which is a built-in implementation of a data collection that implements the INotifyCollectionChanged
interface.
Please update your myin
and Button_Click
as :
ObservableCollection<int> myin = new ObservableCollection<int>();
private void Button_Click(object sender, RoutedEventArgs e)
{
myin.Remove(34);
}
Then your demo will work like below:
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.