I want to customize my headers to be different colors on my SfDataGrid. The trouble is, that I have to update my header names based on some other inputs on my tool.
I am able to get the HeaderTemplate to update to my correct initial settings but cannot seem to update the value easily.
What I'm hoping is that I can bind my internal label text to the MappingName, might look something like this in XAML, but I'm looking for the C# version.
<syncfusion:SfDataGrid.Columns>
<syncfusion:GridTextColumn MappingName="OrderID">
<syncfusion:GridTextColumn.HeaderTemplate>
<DataTemplate>
<Label x:Name="OrderID" Text="{Binding MappingName}" TextColor="Black" />
</DataTemplate>
</syncfusion:GridTextColumn.HeaderTemplate>
</syncfusion:GridTextColumn>
</syncfusion:SfDataGrid.Columns>
Here is kinda what I'm looking for...
private static DataTemplate HeaderTemplate(Color color) {
return new DataTemplate(() => {
var label = new Label() { Text = (#WHAT GOES HERE?#), BackgroundColor = color };
return new ViewCell { View = label };
});
}