| | | 
StrataFrame Novice
       
Group: StrataFrame Users Last Login: 05/30/2008 10:52:28 AM Posts: 72, Visits: 251 |
| | Hi there. I have a string custom property in a BO which I bind to a MicroFour.StrataFrame.UI.Windows.Forms.DevEx.TextEdit. When setting the value of the property at run-time, with code Customer.CustomProperty = "SomeValue"; the control does not show the changed value. Is it something I'm not doing right? BindingUpdateMode and ControlSourceUpdateMode are both OnPropertyChanged. I have tried this with your DevEx sample application, and does not work there either. |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Today @ 11:13:06 AM Posts: 4,104, Visits: 4,176 |
| | There are several options here, but the reason is that there is not a native Changed event managing the custom property. However, you can do several things, you can create a custom event (propnameChanged as EventHandler) that is raised when the value is changed....or just call the Refresh method on the BO: Customers.Refresh("MyCustomFieldName") or within the property Me.Refresh("MyCustomFieldName") |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: 06/17/2008 9:28:35 AM Posts: 2,649, Visits: 1,863 |
| | If the custom property does not have a backing field within the underlying DataTable, you will need to raise a "Changed" event when the property is set. The event needs to be an EventHandler and needs to be named PropertyNameChanged where "PropertyName" is the name of your property (i.e. TextChanged on a textbox). The .NET binding system will then find the event and add a handler to it to determine when to refresh the control. So: public event EventHandler CustomPropertyChanged;
protected virtual void OnCustomPropertyChanged(EventArgs e) { if (CustomPropertyChanged != null) { CustomPropertyChanged(e); } } [all of the necessary attributes] public string CustomProperty { get { return _customProperty; } set { if (_customProperty != value) { _customProperty = value; OnCustomPropertyChanged(EventArgs.Empty); } } }
www.bungie.net |
| | | | 
StrataFrame Novice
       
Group: StrataFrame Users Last Login: 05/30/2008 10:52:28 AM Posts: 72, Visits: 251 |
| | Thank you guys. It's really nice knowing I can count on you... |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: 06/17/2008 9:28:35 AM Posts: 2,649, Visits: 1,863 |
| | |
|
|