Hello
I have a grid bound to a DataTable with only one column editable. This column uses as editor a Custom Control with combos inside, and a UltraControlContainerEditor instance is used in order to embed the custom control into a cell.
My problem is that the cells are not being updated after leaving the editor (clicking elsewhere). I am positive that the value inside the Custom Control has changed.
I have noticed that the Get method of the editing property of the custom control is being called twice after leaving the cell, returning always the last selected value (because is the same cell). I don't know if that is normal grid behaviour.
Is there any particular consideration to take into account when using the UltraControlContainerEditor with a grid bound to a DataTable?
Thanks a lot.
Yeah, it looks for an event with the name of the property plus the word "changed" after it. This is a bit weird and unintuitive, but it's modelled after the way the BindingManager works in DotNet. If you bind a property of a control, the DotNet Framework looks for an event with the same name as the property with "Changed" appended to it.
I don't know for sure, but I think the unintuitiveness of this is probably one of the reason MS came up with the INotifyPropertyChanged interface. :)
EMoscosoCam said:Now, what I fail to understand is how the UltraControlContainerEditor is going to "catch" the raised MappingChanged event. How the ucce "knows" that this event should be "monitored"?
When you assign the EditingControl, you can also specify which property on that control should be used. You do this by setting the EditingControlPropertyName property.
If you don't specify a property name, I think it falls back to looking for a Value property or a Text property.
Thanks. The editing control property name is "Mapping", which is a String. The control has a MappingChanged event handler, which is raised accordingly when the child controls value changes. Provided this is all that is required in order the notify the ucce, I think that this should work. However, as said in my previous post, it doesn't.
Now, what I fail to understand is how the UltraControlContainerEditor is going to "catch" the raised MappingChanged event. How the ucce "knows" that this event should be "monitored"?
Any recommendations would be very appreciated.
In order to update a cell, your EditingControl has to notify the UltraControlContainerEditor that something has changed. This will in turn notify the grid that something has changed and mark the row as edited.
There are two ways to do this.
1) Fire an event for whatever property you are using on your EditingControl. For example, if you are using the Value Property of your EditingControl (the default), then your control has to fire a ValueChanged event and time the value changes.
2) The other way to do this is to implement INotifyPropertyChanged on your control and fire off this notification any time the property you are using changes.