Hello all..
I'm currently working with an UltraGrid control with a bound data source to a generic list. What I'm hoping to accomplish is to embed a custom user control in the child band for each of the items displayed in the grid. I have done some searching on the forums, and found some posts that refer to a method of utilizing the UltraExplorerBar, UltraControlContainerEditor, and the UltraControlContainerEditor, but the example given was done solely through the designer. This is not an optional approach for me, and I need to achieve the same results programmatically.
Based on the designer code inside the example, this is what I've come up with so far..
Private _userContainer As New Infragistics.Win.UltraWinEditors.UltraControlContainerEditor Private _ebContainerCtl As New UltraExplorerBarContainerControl Private _projSumCtl As New MyUserControl() Private _headerAppearance As New Infragistics.Win.Appearance With {.BackColor = Color.WhiteSmoke, .BackColor2 = Color.Silver, .BackGradientStyle = GradientStyle.GlassTop37}
Private Sub SetupEmbeddedDetailsControl() _ebContainerCtl.Controls.Add(_projSumCtl) _userContainer.RenderingControl = explorerBar
explorerBar.Controls.Add(_ebContainerCtl)
With explorerBar Dim group As New UltraExplorerBarGroup("ProjectDetails") .Groups.Add(group) group.Container = _ebContainerCtl group.Text = "Project Details" .Size = _projSumCtl.Size
.TabIndex = 1 .Visible = False
.GroupSettings.AppearancesSmall.HeaderAppearance = _headerAppearance .GroupSettings.AppearancesSmall.ActiveAppearance.BackColor = Color.WhiteSmoke .GroupSettings.HeaderButtonStyle = UIElementButtonStyle.ButtonSoft .GroupSettings.Style = GroupStyle.ControlContainer .Style = UltraExplorerBarStyle.VisualStudio2005Toolbox End With
With Me.DisplayLayout.Bands(1) .Columns.Add("Details") .Columns("Details").EditorComponent = _userContainer End With End Sub
If possible, can someone tell me if this is headed in the right direction or provide some example for achieving this programmatically? I'm not using an UltraDataSource like the example does, but that's the only major difference I've been able to notice.
I'm currently using v11.2 controls.
Thanks!
Hi,
I'm a little unclear on exactly what you are trying to do, but I think your code here might be on the wrong track.
The UltraControlContainerEditor allows you to embed a control (any control) into a cell in the grid. But the control in question needs to be designed in such a way that it deals with a single value that it gets from the grid cell. So I'm not very clear on where the ExplorerBar control comes into play here. You seem to be just using an ExplorerBar, so then why do you need a UserControl?
Is that what you want - an ExplorerBar in a grid cell? If so, then how does the ExplorerBar link up to the cell's value? What is the data type of the column you are using here and how do those values relate to the ExplorerBar?
There are samples included with NetAdvantage (assuming you chose to install them) which demonstrate how to set up the UltraControlContainerEditor at run-time. So you should probably take a look at those first. The location on the hard drive is something like this:
...\2011.2\Samples\WinEditors\VB\ControlContainerEditor VB
I'll try to clarify a little more on what I'm trying to achieve...
I have a custom user control, that allows the user to view detailed summary information for the bound object whenever the parent row for that object is expanded. For example, if I have a "Project Item" as the parent row list object, and I click the expansion indicator to the left of the row, I want the child band to contain my custom user control and be populated for that project's detailed summary.
Based on your reply, I'd need to have my project item to contain a "Details" property that would create my child band within the grid. Then use the "Details" for that "Project Item" to apply the renderer class to the user control, which should populate my user control for that row with the information provided. Correct, or am I misunderstanding the process here?
I've been looking at the local ControlContainerEditor example, and have tried to create my own "renderer" class to assign to the .Editor property for the specified column. This does render the control like it's supposed to, but the user control isn't being populated with the row's information. Does this assignment have to occur within the InitializeLayout event, since it's on a per-row basis? If so, how can I achieve the proper information for each child rows' information inside of that event?
Thanks for the quick reply and detailed assistance!