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
490
Changing the Column Width from code behind
posted

Hi,

I have a requirement where I need to set the width of a column to "Auto". I am able to do this from XAML code but couldn't find a way to set it from code behind.

Though, I am aware that to change the width I can use - column.Width = new ColumnWidth(3.5, true);

but with this approach I am not sure if the width can be set to "Auto".

Any suggestions on this is appreciated.

Thank You,

Raj

Parents
  • 6365
    Offline posted

    Hello Raj,

    In order to set the width of a column in XamGrid to Auto in code-behind, you can set the Width property of the respective column to ColumnWidthType.InitialAuto or ColumnWidthType.Auto.

    Code-behind:

    xamGrid.ColumnWidth = ColumnWidthType.InitialAuto;

    For more detailed information, you can take a look at Change Column Width Settings.

    If you require any further assistance on the matter, please let me know.

Reply Children