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
1015
Embed a User Control inside an UltraGrid child band programmatically
posted

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!