We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

change color for GroupColumnDescriptions

Thread ID:

Created:

Updated:

Platform:

Replies:

141559 Dec 18,2018 07:41 AM UTC Dec 19,2018 11:58 AM UTC Xamarin.Forms 2
loading
Tags: SfDataGrid
asolute dev
Asked On December 18, 2018 07:41 AM UTC

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


asolute dev
Replied On 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 ?



Vigneshkumar Ramasamy [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;