DenaliHardtail
DenaliHardtail

Reputation: 28306

Checkboxes not updating as expected

I have a listbox bound to a list of business objects. The items in the listbox are formatted using an itemtemplate. The itemtemplate includes a checkbox bound to a boolean property of the business object. When I spin up the app, the bool prop on the object in the list is changed when I click the checkbox. so far, so good.

The dialog has "select all" and "clear all" buttons. When I click on of these buttons, the properties on the objects are changed but the checkbox does not update.

The code in the select all click event is. . .

For Each x As BusObj In _BusObjList
  x.BlockIsInserted = True
Next

I can step through the code and watch the object properties change but the checkbox does not update. Any suggestions?

Thanks,

Upvotes: 1

Views: 752

Answers (2)

Chris Bova
Chris Bova

Reputation: 49

I've encountered the same issue, even with the binding set to two-way and the view model representing the business object correctly implementing INotifyPropertyChanged. The (rather brute-force) solution I found was to NotifyChanged on the property representing the collection of business objects - this fixes the problem.

Upvotes: 1

Arsen Mkrtchyan
Arsen Mkrtchyan

Reputation: 50712

using twoway binding should help I guess

{Binding ..., Path=Text, Mode=TwoWay}

And yes, is BlockIsInserted property dependency? or implemented INotifyPropertyChanged?

Upvotes: 3

Related Questions