Hi,
I would like to place a custom control in a cell. This control should get the ListObject of its row (this I could do in Grid_initializeRow).
My question is: Do I get a separate instance of the control for every row. I would need that because the control should also show information related to its row. This information should be visible at all time.
If all rows share the same instance of the control, that would not be possible.
How could I achieve the desired behavior?
Thanx!
that brings me half way.
Problem is, that my ListObject is a class that holds the information for a row. In order to assign this ListObject to the Value property of a cell it needs to implement IConvertible.
I've done that, but it would always try to convert it ToString and give that string value to my underlying editor as value. My custom editor control needs the class representing the data of it's row.
So I'm stuck here.
To explain my goal: My custom editor will show a status and a dropdownbutton. Once the user presses the button, a dropdownpanel with many other buttons etc will show. These controls will allow the user to perform operations on the row's underlying ListObject. It is kind of a "control center" for the row that should be hidden to save space.
I hope you can help with that.
Hello,
For a scenario like this, you will want to use the ControlContainerEditor.
Inside the grid's InitializeLayout event handler, you can add an unbound column and assign an new instance of the ControlContainerEditor to the column's Editor Property. On the ControlContainerEditor itself, you will want to assign new instances of your custom control to the RenderingControl/EditingControl properties.
Now in the grid's InitializeRow event handler, you can assign the row's ListObject to the Value for the cell in your new column.
When the cell is drawn or goes into edit-mode, the ControlContainerEditor will assign the cell value to the property on the custom control specified by the editor's RenderingControlPropertyName/EditingControlPropertyName which is "Value" by default. Your custom control is responsible for updating itself based on this value.
This link demonstrates using the ControlContainerEditor within the UltraGrid.
Note: Make sure the routine within your custom control to update itself is as efficient as possible, as since the ControlContainerEditor uses a single instance of your custom control for rendering purposes, it will be changing the Value of the control quite often.
Let me know if you need any further details.
Thanks,
Chris