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
1065
How to change the label height in procedure code.
posted

Hello,

How could I change xamDataGrid label height in procedure code?

I tried the below code, but it didn't work.

Private Sub GridInfragistics_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
     
        'ColumnHeaderHeight is a dependency property of the GridInfragistics user control and it is greater than 0
        If ColumnHeaderHeight > 0 Then          
            Dim labelPresenter As LabelPresenter = TryCast(Infragistics.Windows.Utilities.GetDescendantFromType(grdTable, GetType(LabelPresenter), False), LabelPresenter)

            If labelPresenter IsNot Nothing Then
                Dim labelParent As DependencyObject = labelPresenter.Parent

                Dim count As Integer = VisualTreeHelper.GetChildrenCount(labelParent)

                For i As Integer = 0 To count - 1
                    Dim child As LabelPresenter = TryCast(VisualTreeHelper.GetChild(labelParent, i), LabelPresenter)
                    If child IsNot Nothing Then
                        child.Height = ColumnHeaderHeight                     
                    End If
                Next
            End If
        End If
  
End Sub

Is there any easy way to change labe height?

Thanks.