public class CustomStyle : DataGridStyle
{
public override Color GetCaptionSummaryRowBackgroundColor()
{
return Color.Yellow;
}
public override Color GetCaptionSummaryRowForegroundColor()
{
return Color.Red;
}
}
//MainPage.xaml
<ContentPage.Resources>
<ResourceDictionary>
<local:CustomStyle x:Key="customStyle" />
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<sfgrid:SfDataGrid x:Name="sfGrid"
AutoGenerateColumns="False"
ItemsSource="{Binding OrdersInfo}"
ColumnSizer="Star"
GridStyle="{StaticResource customStyle}"
>
<sfgrid:SfDataGrid.Columns>
<sfgrid:GridTextColumn MappingName="OrderID" />
<sfgrid:GridTextColumn MappingName="EmployeeID" />
<sfgrid:GridTextColumn MappingName="CustomerID" />
<sfgrid:GridTextColumn MappingName="ShipCountry" HeaderText="Country"/>
</sfgrid:SfDataGrid.Columns>
<sfgrid:SfDataGrid.GroupColumnDescriptions>
<sfgrid:GroupColumnDescription ColumnName="CustomerID" />
</sfgrid:SfDataGrid.GroupColumnDescriptions>
</sfgrid:SfDataGrid>
</ContentPage.Content> |