What are the widths of the Filter and Sort Indicator glyphs which are displayed in the ColumHeader?
Hello Mike,
Thanks for the response! For the benefit of others, here is what I did.
' Class level variables. Private m_LastSortColumn As Infragistics.Win.UltraWinGrid.UltraGridColumn = Nothing
Private m_LastSortColumnWidth As Integer
Private Sub UltraGrid1_BeforeSortChange(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeSortChangeEventArgs) Handles UltraGrid1.BeforeSortChange Try Me.UltraGrid1.Cursor = Cursors.WaitCursor
For Each column As Infragistics.Win.UltraWinGrid.UltraGridColumn In e.SortedColumns ' Ignore group by columns created by user dragging a column header ' on to or off of the run time group by tray. If Not column.IsGroupByColumn Then If m_LastSortColumn IsNot Nothing Then ' Restore the old width without the sort glyph. Me.UltraGrid1.DisplayLayout.Bands(e.Band.Index).Columns(m_LastSortColumn.Key).Width = m_LastSortColumnWidth End If
' Save the current value. m_LastSortColumn = Me.UltraGrid1.DisplayLayout.Bands(e.Band.Index).Columns(column.Key) m_LastSortColumnWidth = m_LastSortColumn.Width End If Next Catch ex As Exception Throw End Try End Sub 'UltraGrid1_BeforeSortChange
Private Sub UltraGrid1_AfterSortChange(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BandEventArgs) Handles UltraGrid1.AfterSortChange Try ' Only save last column if sort glyph caused the column width to be resized. If m_LastSortColumnWidth >= m_LastSortColumn.CalculateAutoResizeWidth(Infragistics.Win.UltraWinGrid.PerformAutoSizeType.None, includeHeader:=True) Then m_LastSortColumn = Nothing Else ' Resize the current column to include the sort glyph. Me.UltraGrid1.DisplayLayout.Bands(e.Band.Index).Columns(m_LastSortColumn.Key).Width = m_LastSortColumn.CalculateAutoResizeWidth(Infragistics.Win.UltraWinGrid.PerformAutoSizeType.None, includeHeader:=True) End If
Me.UltraGrid1.Cursor = Cursors.Default Catch ex As Exception Throw End Try End Sub 'UltraGrid1_AfterSortChange
Well, I would probably use the AfterSortChange event. You can check what the sorting on the column was before it changed and after it changed and see if it went from no sorting to sorted and then re-size the column only in that one case.
Hello Scott,
We call the CalculateAutoResizeWidth method including the headers on all of our columns. A handful of the columns contain small integer values and so the width is based on the column header caption property which includes the Filter glyph for all columns.
If a user sorts on one of the small integer columns, the Sort glyph is not displayed because there is no room for it.
Ideally, what I would like to do is recheck the width in the ColumnClick event and resize the column if there is not enough room for the Sort glyph to be displayed in the header. Is this plan of attack the best one to take?
Hi,
What do you need these sizes for?
I think the only way to get these is via UIElements, although, I am pretty sure they are fixed and don't change.
Are you talking about just the width or the height, as well? The elements take up the entire column header height, so the height really has no meaning.