FlexGrid manually assign binding name

Posted by: chris on 6 March 2025, 6:10 pm EST

  • Posted 6 March 2025, 6:10 pm EST

    I need to add columns manually:

    Columns.Add(new GridColumn()

    {

    ColumnName = Name,

    IsReadOnly = !Allow,

    Header = Name,

    HeaderHorizontalAlignment = LayoutAlignment.Center,

    Background = ColorRow(Columns.Count)

    });

    However, the grid itself will be bound to a model, so how do I speicfy the binding name when adding a column?

    For some other grids I am trying, they use something like Map = somestring

    Basically I need to programmatically do the equivalent of this xaml code:

    <c1:GridColumn Binding=“FirstName” />

  • Posted 6 March 2025, 6:35 pm EST

    It looks like it is actually Binding = string?

  • Posted 7 March 2025, 2:17 am EST

    Hi Chris,

    To bind a column to a field in your model, you can set the GridColumn.Binding property to the field name. Please refer to the attached sample project for reference.

    FlexGrid.Columns.zip

    Best Regards,

    Kartik

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels