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
20
Column Resizing Help
posted

Hello All,

I am a very new user to Ultragrid.

I am trying to resize a clicked column to show its whole content by resizing its row and its width. I am using vbnet2005.

For example, a columns content is 1000 characters and its viewable content is truncated because the grid is not big enough. When the user clicks that column, it needs to resize the row its on and the column width to show its content on multiple lines without resizing the font or the other rows. How can I achive this?

Thank you

I have found no documentation that could help me achive this!

 

Parents
No Data
Reply
  • 5118
    posted

    Hello,

    When a user selects a column you want to resize it?  Is this what you are after? 

     Handle the AfterSelectChange event of the grid and check the e.Type.Name == "ColumnHeader"

    If so then autosize that column:

    ' column selected
    Dim col As UltraGridColumn = Me.ultraGrid1.Selected.Columns(0).Column
    Dim width As Integer = col.CalculateAutoResizeWidth(Infragistics.Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand, True)
    col.Width = width
    ' or you can do this:
    'col.PerformAutoResize(PerformAutoSizeType.AllRowsInBand, true)

    Don't forget to change the HeaderClickAction property so the user can select a column:

    ultraGrid1.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.Select

    If you wanted to resize all the columns you can do the following:

    ultraGrid1.DisplayLayout.PerformAutoResizeColumns(false, Infragistics.Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand, true)

Children
No Data