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
115
Auto sizing columns
posted

hello all,

 I got a quick question about the UltraWinGrid.

i have X amount of column in a grid, for this exemple let's say 2.

All i am looking for is the grid to AUTOSIZE each column either with:

the caption if its bigger than its content,

or its content if its caption is smaller.

So basicaly, if col 1 has for caption - Administration, and the content are Letters, i want the grid to autosize the col to the size of "Administration"

and if col 2 has for caption - Items, and the contents are numbers looking like : 3238495843964885934568, i need the col to autosize to the largest number.

Thank you in advance,

John

Parents
No Data
Reply
  • 5
    posted

    The solution is simply

    Like Mike said  "You need to call PerformAutoSize after the data has been added. "

     

    DataSet dsSource = GetDataSource( );

    this.UltraGrid1.DataMember = dsSource.Tables[0]; 

    this.UltraGrid1.DataSource = dsSource;

    foreach (UltraGridColumn col in UltraGrid1.DisplayLayout.Bands[0].Columns)

    {

    col.PerformAutoResize(PerformAutoSizeType.AllRowsInBand);

    }

     

    Greetings

     

    MCP, Alex Cordova

    EXPALSA 

Children
No Data