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

Extended GridStackedHeaderCellRenderer style binding doesnt work in sf 2015 v 2

I have this block in code for styling stacked headers. It used to work fine but after upgrade to v2 throws compilation errors. The signature of OnInitializeEditElement has changed.

Grid.CellRenderers.Remove("StackedHeader");
Grid.CellRenderers.Add("StackedHeader"new GridStackedHeaderCellRendererExt(Grid));
...
...
public class GridStackedHeaderCellRendererExt : GridStackedHeaderCellRenderer
    {
        private SfDataGrid totalPaidGrid;
 
        public GridStackedHeaderCellRendererExt(SfDataGrid totalPaidGrid)
        {
            // TODO: Complete member initialization
            this.totalPaidGrid = totalPaidGrid;
        }
        // override the OnInitializeEditElement
        public void OnInitializeEditElement(
                                            Syncfusion.UI.Xaml.ScrollAxis.RowColumnIndex rowColumnIndex,
                                            GridStackedHeaderCellControl uiElement, GridColumn column, object dataContext)
        {
            var colum = (dataContext as StackedColumn);
            if (colum.ChildColumns.Contains("Total"))
            {
                var style = totalPaidGrid.Resources["customCellStyleStackedHeaderTotal"as Style;
                uiElement.Style = style;
            }
            else
            {
                var style = totalPaidGrid.Resources["customCellStyleStackedHeader"as Style;
                uiElement.Style = style;
            }

            base.OnInitializeEditElement(rowColumnIndex, uiElement, column, dataContext);

        }     }

1 Reply

JN Jayaleshwari N Syncfusion Team July 16, 2015 12:55 PM UTC

Hi Senthil,

We are sorry about the inconvenience caused.

We have changed the override methods’ s parameters for all renderers. We have mentioned the changes details in Release Notes also. Please refer the following link to know the changes that we have made in our latest release.

Release Notes: https://s3.amazonaws.com/files2.syncfusion.com/Installs/v13.2.0.29/ReleaseNotes/WPF.html

You have to modify the method signature as below. From dataColumn parameter, you can access RowColumnIndex and GridColumn.

public class GridStackedHeaderCellRendererExt : GridStackedHeaderCellRenderer

{

    private SfDataGrid totalPaidGrid;


    public GridStackedHeaderCellRendererExt(SfDataGrid totalPaidGrid)

    {

        // TODO: Complete member initialization

        this.totalPaidGrid = totalPaidGrid;

    }

    // override the OnInitializeEditElement


    public override void OnInitializeEditElement(DataColumnBase dataColumn, GridStackedHeaderCellControl uiElement, object dataContext)

    {

        var colum = (dataContext as StackedColumn);

        if (colum.ChildColumns.Contains("Total"))

        {

            var style = totalPaidGrid.Resources["customCellStyleStackedHeaderTotal"] as Style;

            uiElement.Style = style;

        }

        else

        {

            var style = totalPaidGrid.Resources["customCellStyleStackedHeader"] as Style;

            uiElement.Style = style;

        }           

        base.OnInitializeEditElement(dataColumn, uiElement, dataContext);

    }     
}


Please let us know, If you have any other queries.


Regards,

Jayaleshwari N.



Loader.
Live Chat Icon For mobile
Up arrow icon