Loading and displaying a child list in windows form app

Loading and displaying a child list in windows form app

Old forum URL: forums.lhotka.net/forums/t/11844.aspx


Helius posted on Monday, February 18, 2013

I have a rule defined in a business object which should create/ load a child list based on some input property values.

Taking into consideration the suggestions i have read in this forum  i am not using

context.addoutvalue (childlistprop, GetList(param1, param2 ...)) 

but instead:

loadproperty (target, childlistprop, GetList(param1, param2 ...)))

target.PropertyHasChanged(childlistprop)

In the windows form user interface, i see that the datagrid which should display the child list is not immediately reflecting the changes from the BO childlist. But whenever i change any other field (bound to other BO properties) in form, related or not  to the above rule, then the data is correctly displayed in the grid. Can someone give any suggestion ?

 

 

JonnyBee replied on Monday, February 18, 2013

It is because Windows Forms will refresh ALL other properties than the one that was changed.

This is the reason Csla.Windows.BindingSourceRefresh exists - to reread the valus from the Property that was changed. 

First make sure that your PropertyChangedMode is set to Windows as for Csla 4 the default is Xaml. When property changed mode is Windows the PropertyHasChanged should normally raise the OnUnknownPropertyChanged event.

If this does not help then you may want to call <bo>.OnUnknownPropertyChanged (a PropertyChanged with NULL or String.Empty as propertyname) to signal reread of all properties or add custom code to refresh the binding.  

 

Helius replied on Monday, February 18, 2013

Jonny thanks, calling <bo>.OnUnknownPropertyChanged resolved my problem.


Copyright (c) Marimer LLC