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
180
Multiselectable dropdown User Control
posted

Normal 0 false 21 false false false ES-AR X-NONE X-NONE MicrosoftInternetExplorer4

Hi

I am using  Infragistic Version 6.3

I need to make a multiselectable user control, my strategy is to combine an UltraTextEditor control with an UltraGrid control, but I have a problem. When I drag my user control to the form and them in designd tiem I asigne a value to the DataSource and after that I go to the collection property and modify some values by default, for example Hidden= true.

I execute the program, it keeps showing all the columns. The code of the grid is not added to the Designer.vb file.

This is the example code.

 

Public Class UserControl1

    'Private g As Infragistics.Win.UltraWinGrid.UltraGrid = New Win.UltraWinGrid.UltraGrid()

    Private g As Infragistics.Win.UltraWinGrid.UltraDropDown = New Win.UltraWinGrid.UltraDropDown

 

    <RefreshProperties(RefreshProperties.All)> _

 Public ReadOnly Property Collection() As Infragistics.Win.UltraWinGrid.ColumnsCollection

        Get

            Return Me.g.DisplayLayout.Bands(0).Columns()

        End Get

    End Property

    <DefaultValue(CStr(Nothing)), AttributeProvider(GetType(IListSource)), RefreshProperties(RefreshProperties.All)> _

  Public Property DataSource() As Object

        Get

            Return Me.g.DataSource

        End Get

        Set(ByVal value As Object)

            Me.g.DataSource = value

        End Set

    End Property

 

    Sub New()

 

        ' This call is required by the Windows Form Designer.

        InitializeComponent()

 

        Me.Controls.Add(g)

 

        Dim b As New Infragistics.Win.UltraWinEditors.DropDownEditorButton

        b.Control = g

        g.Width = UltraTextEditor1.Width

        UltraTextEditor1.ButtonsRight.Add(b)

 

        ' Add any initialization after the InitializeComponent() call.

 

    End Sub

 

    Private Sub UserControl1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize

        g.Width = UltraTextEditor1.Width

    End Sub

End Class

Do you have any idea of what might be the problem?

sorry about my English....

 

  • 469350
    Suggested Answer
    Offline posted

    Hi,

    Getting this to work will probably be extremely difficult, if it's possible at all. What you are basically trying to do here is serialize a child control within another control.

    If you exposed the WinGrid as a public property on your UserControl and also added some attributes on the property like DesignerSerializationVisibility, it might work, but I suspect the grid's serialization is too complex for it to work a a child property of another control.

    I recommend that you either handle the InitializeLayout event of the grid inside the UserControl and hide the columns there, or else you save the grid layout to a file at design-time and then load it into the grid at run-time.