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.
Unfortunately, activation email could not send to your email. Please try again.

Extended GridStackedHeaderCellRenderer style binding doesnt work in sf 2015 v 2

Thread ID:

Created:

Updated:

Platform:

Replies:

119629 Jul 16,2015 02:45 AM Jul 16,2015 08:55 AM WPF 1
loading
Tags: SfDataGrid
Senthil Ramanathan
Asked On July 16, 2015 02:45 AM

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);

        }     }

Jayaleshwari N [Syncfusion]
Replied On July 16, 2015 08:55 AM

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: http://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.



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.

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.

;