I’m looking for a way to create grid rows that expand into a user-definable panel of controls. I’ve found a few possibilities that come close but don’t quite do what we want:
Do you have any suggestions?
Hi Jeff,
It's a bit tricky to answer this question without knowing more about your requirements.
What do you mean by "a user-definable panel of controls?" How user-definable are you talking about here? Is this a single control or UserControl? Or are you suggesting that users can create and customize their own controls?
- The expandable group box gives us flexibility for the expanded controls, but the header content must be strings
An ExpandableGroupBox has a header that shows text. So I'm a bit confused about what you mean here or what the problem is.
- Using multiple bands allows grid columns in the top-level control, but the expanded info must be grid data
Yes, that's true. You would need to structure your data source in such a way that you have parent rows and then child rows. Presumably, this is okay and all you really want to do is change the display of the child data so it's not displayed as typically grid cells.
- I’ve looked at the row layout grid option, but I’m not sure if it could be used for a child band and/or if the column headers could be eliminated.
RowLayouts are pretty flexible, but at the end of the day, it's just grid cells in a more complex layout. You can hide the column headers in the child rows, though. So that might work for you if you can arrange your child rows in some kind of layout of grid cells.
Another option would be to use an UltraControlContainerEditor. This allows you to embed a control into a grid cell. So you could have a child band in your data with a single column and then the data for that column would bind to some Control or UserControl that you created.
If it's just a single control then that would make things simpler. But then we come back to "user-definable" and I'm not sure what that means. Does that mean the user picks one of a number of possible options? Or is it more complex than that?
How complicated it the control you would want to display? A control that has a single Value property is very easy to implement, but if you have a complex control with a dozen different TextBoxes or other controls within it then your child data will have to contain an object that has properties for each one and you'd have to handle a lot of the interaction between the grid data, the editor, and the display.
Thanks for the reply, and sorry for the vague "user-definable" term. What I meant is that different rows in the grid would need to expand to different known sets of controls depending on the type of the parent. The controls would include multiple text boxes / combo boxes / property grids. (So one parent type might require three text boxes and a property grid in the child band, and a different parent type might require a couple of combo boxes.) From your reply, sounds like the single-column UltraControlContainerEditor might be a possibility, but we would need a separate object for each control and we would have to manually map data between the objects and the controls, is that right? Could we use different sets of objects and controls for different types, or if not could we define "masters" that are the union of all needed objects/controls and ignore/hide those that don't apply to a particular type? Hope that question makes sense.
The need for flexibility in the set of controls by type is what initially drove us to the ExpandableGroupBox, but the fact that headers must be strings prevents us from showing extended info in a columnar format when the group boxes are collapsed, which is a problem. I haven't tried using tabs in the header strings to see if we could approximate the grid look. I'm open to some alternative like that, but utilizing parent-child bands with the ability to edit using controls that we specify sounds like the more elegant approach if we can get it to work. Would love to see an UltraControlContainerEditor example with multiple child controls if you have one.