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