Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
546
Custom control in a cell with status information for the row
posted

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!

Parents
No Data
Reply
  • 6158
    Suggested Answer
    Offline posted

    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 

Children