Hi to All. Does anyone know the property which is used to control (or at least read) the height of the GroupByBox on an UltraGrid control?
Hi,
You can't set the height of the GroupByBox, it's calculated automatically as needed.
You might want to look at grid.DisplayLayout.GroupByBox.Style which allows you to set the GroupByBox to Compact style and make it take up a little less room.
There's no property for determining the height, either. But if the grid is displayed and has painted at least once, you could probably get the rect using UIElements.Something like this:
UIElement gridElement = this.ultraGrid1.DisplayLayout.UIElement; if (gridElement != null) { UIElement groupByBoxUIElement = gridElement.GetDescendant(typeof(GroupByBoxUIElement)); if (groupByBoxUIElement != null) Debug.WriteLine(groupByBoxUIElement.Rect); }
The 'Style' attibute isn't availiable for my GroupByBox. Has this changed?
Thanks Mike. That is just what I was after. For the benefit of VB devs this is a function based on your code:
Private Function GetGroupBoxHeight(ByVal grid As UltraGrid) As Integer Dim result As Integer = 0 If Not grid.DisplayLayout.GroupByBox.Hidden Then Dim gridElement As UIElement = grid.DisplayLayout.UIElement If gridElement IsNot Nothing Then Dim groupByBoxUIElement As UIElement = gridElement.GetDescendant(GetType(GroupByBoxUIElement)) If groupByBoxUIElement IsNot Nothing Then result = groupByBoxUIElement.Rect.Height End If End If End If Return resultEnd Function