lundi 20 mars 2017

Mvvm Unchecking a Checked Box in an underlying Listbox object

I have a listview that's item source is databound to an observable collection of a custom datatype. Each object in the list has the property DisplayName (string) and IsChecked (bool), among others. The data template essentially is :

<CheckBox VerticalAlignment="Center" Content="{Binding DisplayName}" IsChecked="{Binding IsChecked}"/>

When I check the boxes, I am able to determine, easily, the underlying items that now have been checked. However in the viewmodel, if i wish to uncheck an item, it does not seem to work going the other way.

I have NotifyProperty change implemented in the setter for the observable collection, but do i need to do something special for the bool?

In the Viewmodel, the following code is where I attempt to uncheck the checked checkboxes (as kind of a refresh after a command has run):

foreach (var bill in AllBills)
{
    bill.IsChecked = false;
}




Aucun commentaire:

Enregistrer un commentaire