Can't find what you're looking for?

Contact us or post in our forums and we'll help you find an answer.

Bind an ExpandoObject to a C1FlexGrid

Property

Value

title

Bind an ExpandoObject to a C1FlexGrid for Blazor | ComponentOne

description

How to bind a ExpandoObject to Blazor C1FlexGrid

keywords

blazor, flexgrid, expandoobject

author

Hunter Haaf

product

Blazor Edition

technology

Blazor

cta

C1_STUDIO

To accomplish ExpandoObject support with Blazor FlexGrid, you should put the column binding properties as shown in the brackets below on your Razor Component page utilizing the FlexGrid. However, sorting and automatic column generation is not supported when binding this type of object to a FlexGrid.

 

HTML Header

<FlexGrid AutoGenerateColumns="false" ItemsSource="@customers">  
  <FlexGridColumns>
    <GridColumn Binding="[Name]" ></GridColumn>

    <GridColumn Binding="[Age]" ></GridColumn>  
  </FlexGridColumns>
</FlexGrid>

 

Code Block

var customers = new ObservableCollection();

dynamic employee = new System.Dynamic.ExpandoObject();

employee.Name = "John";

employee.Age = 18;

dynamic employee2 = new System.Dynamic.ExpandoObject();

employee2.Name = "Paul";

employee2.Age = 22;

customers.Add(employee);

customer.Add(employee2);