views:

257

answers:

1

I have a user control that inherits from the ListBox class and displays a list of a custom class I have named DataSeries.

Each DataSeries has several dependency properties, like LineColor for example. I can bind my DataSeries collection to the listbox itemsource with no problems, and it displays with the template I have defined (the template uses a few of the DataSeries properties).

My question is, if I change one of the DataSeries properties is it possible to raise an event to let the listbox know?

For instance, I have a color picking dialog and it updates the LineColor for a DataSeries in the bound collection. After the dialog is closed I would like the ListBox to reflect the change, as well as fire off an update event for another usercontrol. I'm sure this is possible I am just not sure how to approach this problem.

Thanks, and any help is appreciated.

+1  A: 

I think my answer to this question applies to your situation too.

HTH, Kent

Kent Boogaart
Thanks for the reply Kent. I wasn't sure if ObservableCollection had something to meet my needs, but looks like it doesn't. Your custom class looks like it will take care of exactly what I need though. I will try it when I get home later, thanks again for your help!
stevosaurus
Just to follow up, I had to make a few very minor changes but your example really helped out. I now have my collection firing off events when an item's property changes!
stevosaurus
Thanks for the follow-up stevo. Were your changes specific to your use case, or more general? I'd be interested to hear what you needed to change.
Kent Boogaart