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. Image for the cookie policy date

Why is SfDataGrid.GridStyle.HeaderBackground deprecated & How to set HeaderBackground right

Why is SfDataGrid.GridStyle.HeaderBackground deprecated in Syncfusion Xamarin.Android (13.4.0.58)?

What is the right way to set SfDataGrid.GridStyle.HeaderBackground from code without using HeaderBackground? There is no SetHeaderBackground method?

3 Replies

HN Harikrishnan N Syncfusion Team February 22, 2016 12:50 PM UTC

Hi Denis,

Thank you for using Syncfusion Products.

The properties in DataGridStyle class are marked obsolete and override methods are exposed instead. This was done in our 13.3.0.18 release and was also mentioned in our service pack release notes and main volume release notes.

ServicePack release notes: https://s3.amazonaws.com/files2.syncfusion.com/Installs/v13.3.0.18/ReleaseNotes/Xamarin_Android.html#Xamarin_Android-Grid
Main volume release notes: http://help.syncfusion.com/xamarin/release-notes/xamarin-android/v13.4.0.53

The right way to customize the header background color is to write a custom style for the SfDataGrid. Please refer the below code example.



SfDataGrid dataGrid = new SfDataGrid();
dataGrid.GridStyle = new CustomStyle();

public class CustomStyle : DataGridStyle

{

    public CustomStyle()

    {


    }


    public override Color GetHeaderBackgroundColor ()

    {

        return Color.Yellow;

    }


}


For more details about writing custom styles for SfDataGrid please check our below user documentation link.

UG link: http://help.syncfusion.com/xamarin/sfdatagrid/styles

Regards,
Harikrishnan



DL Denis Lapiner February 23, 2016 07:44 AM UTC

Thanks for the detailed information!


HN Harikrishnan N Syncfusion Team February 24, 2016 11:36 AM UTC

Hi Denis,

Thanks for the update.

Please let us know if you require further assistance on this.

Regards,
Harikrishnan


Loader.
Up arrow icon