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
135
UltraGroupBox - customizing header
posted

Hi,

I am having a requirement to modify the header area of the UE groupbox to add custom text at runtime.

This cannot be done along side the caption.I need to change the color and size of the new text which is going to be displayed at runtime.

I added a UltraLabelControlUIElement to my GroupBoxHeaderUIElement

 

 This is my class

Public Class MyUIElement

Inherits Misc.UltraLabelControlUIElement

Private UILabel As UltraLabel

Public Sub New(ByVal parent As UIElement, ByVal label As UltraLabel)

MyBase.New(label)

End Sub

Protected Overrides Sub OnDispose()

MyBase.Dispose()

End Sub

End Class

 These are my  Methods

Public Function BeforeCreateChildIElements(ByVal parent As Infragistics.Win.UIElement) As Boolean _

Implements Infragistics.Win.IUIElementCreationFilter.BeforeCreateChildElements

Return False

End Function

Public Sub AfterCreateChildElements(ByVal parent As Infragistics.Win.UIElement) _

Implements IUIElementCreationFilter.AfterCreateChildElements

Dim RC As Rectangle

Dim lblRestriction As UltraLabel

If TypeOf parent Is GroupBoxHeaderUIElement Then

Dim GroupBoxHeader As GroupBoxHeaderUIElement = CType(parent, GroupBoxHeaderUIElement)

lblRestriction = New UltraLabel()

' create a new instance of MyUIElement to place in the Navigation Overflow Button Area

Dim ElementtoAdd As New MyUIElement(GroupBoxHeader, lblRestriction)

RC = GroupBoxHeader.RectInsideBorders

RC.Width = 150

RC.X = 500

ElementtoAdd.Rect = RC

ElementtoAdd.Label.Appearance.ForeColor = Color.Red

ElementtoAdd.Label.Appearance.BackColor = Color.Transparent

ElementtoAdd.Label.Text = "RESTRICTION"

ElementtoAdd.ChildElements.Clear()

' add the custom UIElement to its parent's ChildElements collection.

GroupBoxHeader.ChildElements.Add(ElementtoAdd)

End If

End Sub

I am able to get the label on the groupbox header.I want to be able to change the text of this element at runtime.but this is simply not working.

I tried this code from main user control.

 Private Sub setLabelforUIElement()

Dim elem As UIElement

Dim labelElement As PermitPanelsControlNew.MyUIElementDim GroupBoxHeader As GroupBoxHeaderUIElement

 

If (Not (TypeOf (uegbPermitMainInfo.UIElement.ChildElements(1)) Is GroupBoxHeaderUIElement)) Then Return

GroupBoxHeader = CType(uegbPermitMainInfo.UIElement.ChildElements(1), GroupBoxHeaderUIElement)

For Each elem In GroupBoxHeader.ChildElements

If TypeOf elem Is PermitPanelsControlNew.MyUIElement Then

labelElement = CType(elem, PermitPanelsControlNew.MyUIElement)

labelElement.Label.Text = "TEST"

' labelElement.

End If

Next elem

 

 Where am I going wrong.I am not able to display the changed text.it always shows the old text.which property should i manipulate.Please help.

 

Thanks

Padmini

 

 

 


 

  • 4341
    Offline posted

    Hello Padmini,

    Did you find any solution for this. We have the same problem. We want to place label control on the header of the group box.

    Looking forward for your reply. 

    Thank you