开发者

Append binding data not replace with binding data

i have a TextBlock Text target with a business object as a Binding Source, and this binding works fine with updates to the business object property propagating to the GUI, with the help of INotifyPropertyChanged

Aim

The default behavior of such a binding is to replace the contents of the control such that say a second update to the business property will overwrite the display of the first update.

I would like the UI to display the first update, then append the second update and so forth, how mig开发者_如何学运维ht that be possible ?

An Implementation?

  1. Im not familiar with even the basic arsenal of wpf controls, would this be easier with a control other than TextBlock?

  2. Or is it possible to do such binding with TextBlock?

It is undesirable for the business object to remember / store the previous updates. I have already tried to use the object parameter in IValueConverter Convert method, but that does not work...


you can use the mvvm pattern and take a viewmodel to collect the propertychanged event data from your business object.

in this viewmodel create a

ObservableCollection<string>_myUpdateList = new ObservableCollection<string>();

proeprty to collect the data.

on UI(View) side i would take a itemscontrol, listbox or something like this and bind the ItemsSource to your ObservableCollection.

thats all. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜