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
100
How to disable UltraGrid columns autoFit to Grid width
posted

I have datasource with dozen of columns.

I'd like to fit columns' width to its content by  executing below code


DisplayLayout.AutoFitStyle     = Infragistics.Win.UltraWinGrid.AutoFitStyle.None;
foreach (UltraGridColumn column in Columns) column.PerformAutoResize( PerformAutoSizeType.VisibleRows, includeHeader  );

it seems working but my problem is that I all columns are 'scaled' to grid's width (so If I enlarge form where grid resides I can see all cells)
I need all columns and content to be fully shown + horizontal scroll bar 

  • 5595
    Offline posted

    Hello Maciej ,

    I followed the code you provided and created a sample of my own, and when I run the sample I can see the grid cells are fully visible with a horizontal scrollbar using the properties you mentioned.

    In the sample I set AutoFitStyle to None though ita a default value of AutoFitStyle  and instead of making foreach loop for the column for PerformAutoResizeColumns method , I directly set the PerformAutoResizeColumns on the grid's DisplayLayout.

    Like this:

    this.ultraGrid1.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.VisibleRows,true );

    and when i run the sample cell are visible with a horizontal scrollbar I  have attached the sample project I used to test this. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.

    If the project does not work correctly, this indicates either a problem possibly specific to your environment, or a difference in the DLL versions we are using. My test was performed using version 18.2.20182.310.
    If the project does show the product feature working correctly, this indicates a possible problem in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.

    Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.

    Please let me know if I can provide any further assistance.


    Sincerely,
    Divya Jain
    Associate Software Developer

    WindowsFormsApplication7.zip

  • 467870
    Offline posted

    My guess is that you are setting AutoFitStyle in some other place in your code, after you set it to None. 
    Or perhaps you are not setting it directly, but maybe you are loading a Layout into your grid that is setting it. 

  • 0
    Offline posted

    I have been trying to do this but it is turning up with the Asus Router App Connection Failed message. What can be the reason behind such an error?