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

SfDataGrid right click at StackedHeaderRow

Thread ID:

Created:

Updated:

Platform:

Replies:

118412 Mar 5,2015 06:32 PM UTC Mar 6,2015 12:14 PM UTC WPF 1
loading
Tags: SfDataGrid
Constantin Patak
Asked On March 5, 2015 06:32 PM UTC

I am having an SfDataGrid with StackedColumnRow and I want to add an event that will be fired when I press right click only on StackedColumnRow in order to open a new config window. 

Does the SfDataGrid have a spesific event for this or is there a work around to achieve this goal?

Thank you

Jayapradha S [Syncfusion]
Replied On March 6, 2015 12:14 PM UTC

Hi Constantin,

Thank you for using Syncfusion products.

We have analyzed your requirement and you can open a new window when right click on a stacked column by using MouseRightButtonDown event and shown in the below code snippet,

Code Snippet:

VisualContainer visualContainer;

        void dataGrid_MouseRightButtonDown(object sender, MouseButtonEventArgs e)

        {

            var point = e.GetPosition(this.dataGrid);

            var propertyInfo = dataGrid.GetType().GetProperty("VisualContainer", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);

            visualContainer = propertyInfo.GetValue(dataGrid) as VisualContainer;

            var rowColumnIndex = visualContainer.PointToCellRowColumnIndex(point);

            var headerRowIndex = dataGrid.GetHeaderIndex();

            if (rowColumnIndex.RowIndex < headerRowIndex)

            {

                Window newWindow = new Window();

                newWindow.ShowDialog();

            }

        }

We have prepared a sample to achieve your requirement and please find the sample from the below location,

Sample Link: StackedHeader.zip

Kindly let us know if you require any further assistance on this.

Regards,

Jayapradha



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.

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

;