public class ObjectWrapperViewModel
{ public object SourceObject { get; set; } //An unknown object, generate the table columns. public bool WasProcessed { get; set; } //Used for styling the data grid row. }
Which is bound to the view with:
WasProcessed
}" Value="True">
WasProcessed
}" Value="False">
The resulting view is (which is what I'd expect):
However, is there a way to point the SfDataGrid to the property "SourceObject" as the main property to display in the grid so the result is displayed like it is below but with the highlighting still.
The result should be:
1) The SfDataGrid generates the columns automaticly for any given object.
2) Should still have access to the "WasProcessed" property (or others) in the ViewModel.
<syncfusion:SfDataGrid AutoGenerateColumns="False" ItemsSource="{Binding Objects}"> <syncfusion:SfDataGrid.Columns> <syncfusion:GridTextColumn MappingName="SourceObject.ID" /> <syncfusion:GridTextColumn MappingName="SourceObject.Name" /> <syncfusion:GridTextColumn MappingName="SourceObject.Offset" /> </syncfusion:SfDataGrid.Columns> </syncfusion:SfDataGrid> |