change color for GroupColumnDescriptions

I wish to change color for    GroupColumnDescriptions base on the status, such as break down the group column description header show red color


2 Replies

AD asolute dev December 19, 2018 08:43 AM UTC

I try to find the change color in GroupColumnDescriptions however there is no such property , can you share some snippet code ?




VR Vigneshkumar Ramasamy Syncfusion Team December 19, 2018 11:58 AM UTC

Hi Asolute,  
 
Your requirement to set the background color for the GroupColumnDescription can be achived by using SfDataGrid.GridStyle.  
 
Please refer the below UG for more details:  
 
Please find the below code snippet to achieve your requirement.  
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>  
 
We have prepared the sample as per your requirement, you can download the same from the below link.  
 
Regards,  
Vigneshkumar R 


Loader.
Up arrow icon