Is there a way to get around using CellProxy controls within the UltraGridRowEditTemplate? I need to use a custom control instead. Ideas?
thanks
-Ken
Hi Ken,
The CellProxy gives you a lot of built-in functionality. It picks up the appearances from the grid cell, for example. It also fires grid events when you edit and move out of the proxy.
If you want to use your own control, then you can certainly do that. Just put the control you want on the RowEditTemplate and bind that control to the RowEditTemplate itself. But you will lose a lot of that built-in stuff. So you will probably need to handle some events and manually set some properties on the replacement control.
"Just put the control you want on the RowEditTemplate and bind that control to the RowEditTemplate itself."
Can you post a quick code sample? I am not sure I get DataBinding the control to the RowEditTemplate.
My thoughts:
I see that the RowEditTemplate has a Row and a ListObject on that row (only when editing or it will be null). My controls (dropdowns) will actually be data bound to different List<>'s. When the user selects an item from the dropdown I will just handle the OnSelectChanged event taking the Value and doing something like this.
AddressInfo address = rowTemplate.Row.ListObject as AddressInfo;
if(address != null) { address.country = cmbCountries.Value as Country;}
Do you think I need to make any calls to the grid.BindingSource so the change persists? It should just work. I haven't actually coded it yet...just thinking it through and not actually at my work machine.
Thoughts?
The easiest way to handle this is to just bind the control at design-time. That's typically when you set up your RowEditTemplate. So you just place the control you want, like UltraTextEditor, on the RowEditTemplate and then look at the Bindings properties on the UltraTextEditor. The Bindings show up at the top of the list of Properties in the property grid. Go to the Value property there and click the dropdown and you will get a list of things you can bind to. The RowEditTemplate will show up in the list and you just pick the appropriate field you want to bind to. You will also want to remove the Proxy for that field.