tags:

views:

32

answers:

1

Hi,

A short discription of the application I'm developing is: It's a WinForms app, where the UI is databinded to some classes that implement INotifyPropertyChanged. That classes are updated by a background thread, and we want to allow the user to see what has been changed.

The current solution in short: every setter of a property is checking if the new values is different than the current one. In the class I'm holding a flags-enum, where every bit represents one of the properties. So if the value changes, the corresponding bit is set. Additionally there is a timer ticking every 2 secs, that takes back that bit after a while. First thing I would like to achieve is to get ride of the mess in the property setters, and to have the logic encaplused somewhere. Another reason is that me might run out of bits within the enum, etc etc... This solution isn't ideal, as it makes it necessary to touch every setter, and maintain an enum property, so I would like to replace this solution with a "better" one (whatever this really means).

I'm wondering if and how somebody else solved that problem already?

tia Martin

A: 

You need to raise a PropertyChanged event when when the value is changed. See for example MSDN

Jacob Seleznev
I have implemented the current class using INotifyPropertyChanged. My solution is working, but I want to replace it with a better one.
Martin Moser
So you get data binding working but you want to know what has been changed? Can you give us a short example in code of what are you trying to achieve?
Jacob Seleznev
Check Binding.BindingComplete event. See MSDN. It could be just what you need.
Jacob Seleznev
again, please I don't need an intro about the basic things of databinding, I'm searching for a general concept for my problem.
Martin Moser