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
300
Add arbitrary control to cell
posted

Is it possible to add a user control to a cell in a UltraGrid? I've been looking at the documentation and fount nothing about that.

My problem is that I need to add something like a calendar view to my application, where each day has two values showing information and a third one editable by the user. However, multiple selection (and editing) is allowed, that's why I wanted to use the UltraGrid.

But I need to add a Datasource to the grid (first problem, as I have 3 values for each "day", but it is easy to find a workaround for this). Now my idea was to intercept the RowInitialize event and add a usercontrol to each cell of the row, as it is done with the ItemDatabound event but I start to think that it is not possible. Am I wrong? Is there an obvious (and unknown for me) way to do that?

 Many thanks!

Parents
  • 469350
    Verified Answer
    Offline posted

        No, it's not possible to any an arbitrary control to the grid. At least, not easily. You could position a control over a cell, but this would require a whole lot of code and you would have to create a control for each visible cell. It's probably not worth it.

        A better alternative might be to create a dropdown. For example, you could create an UltraTextEditor control on the form and add a DropDownEditorButton to it's ButtonsRight collection. You could set the Control property of this DropDownEditorButton to any arbitrary control. Then you would set the EditorControl property on the grid column to the UltraTextEditor and you could then drop down your control in a grid cell. 

        You would have to handle events for when to close the dropdown and update the grid cell, of course.  

Reply Children