| public class CustomConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { Group group = value as Group; SfDataGrid dataGrid = parameter as SfDataGrid; if(group != null && dataGrid != null) { var val = SummaryCreator.GetSummaryDisplayText(group.SummaryDetails, "CustomerID", dataGrid.View); return group.Key + ":" + " " + val + " " + "items" ; } return value; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return value; } } |
| dataGrid.GridStyle = new CustomStyle(); |
| public class CustomStyle:DataGridStyle { public CustomStyle() { } public override ImageSource GetGroupCollapseIcon() { return ImageSource.FromResource("SfDataGridSample.flower.png"); } public override ImageSource GetGroupExpanderIcon() { return ImageSource.FromResource("SfDataGridSample.flower.png"); } } |
| dataGrid.GridStyle = new CustomStyle(); |
| public class CustomStyle :DataGridStyle { public override Color GetCaptionSummaryRowForegroundColor() { return Color.Red; } } |
| //Defining custom CellRenderers for caption summary. dataGrid.CellRenderers.Remove("CaptionSummary"); dataGrid.CellRenderers.Add("CaptionSummary", new GridCaptionSummaryExt()); |
| public class GridCaptionSummaryExt : GridCaptionSummaryCellRenderer { public GridCaptionSummaryExt() { } public override void OnInitializeDisplayView(DataColumnBase dataColumn, SfLabel view) { base.OnInitializeDisplayView(dataColumn, view); if (view == null) { var templatedView = ((ContentView)(dataColumn as IElement).Element).Content as Label; templatedView.TextColor = Color.Red; } else view.TextColor = Color.Red; } } |
| <sfgrid:GridSummaryColumn Name="OrderId" Format="{}{Count}" SummaryType="CountAggregate" MappingName="OrderID"> <sfgrid:GridSummaryColumn.Template> <DataTemplate> <Label Text="{Binding Converter={StaticResource converter}, ConverterParameter={Reference dataGrid}}" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" TextColor="Blue"></Label> </DataTemplate> </sfgrid:GridSummaryColumn.Template> </sfgrid:GridSummaryColumn> |