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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Programmatically select row when using Cell Merge feature in SfGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

131589 Jul 18,2017 10:49 AM UTC Jul 25,2017 06:39 PM UTC WPF 3
loading
Tags: SfDataGrid
BAO YADONG
Asked On July 18, 2017 10:49 AM UTC

Hi,

I have 2 query here that require your support.

1) How can i programmatically select entire row when using cell merge feature in sfgrid? I noticed that from this link, it stated that "Row selection is not supported". Is there any workaround for this issue?

2) I have row style and alternating row style for my grid, when using cell merge, how can i style the cell according to the merged cell? As you can see from the attached sample(taking row 3 as example), column 1 to 8 are merge and the background color should be the same (should be both white), and column 9 and 10 are not merge so it is correct to have different color.

Thanks.

Attachment: Untitled_140d9c56.rar

Muthukumar Kalyanasundaram [Syncfusion]
Replied On July 21, 2017 04:06 AM UTC

Hi Bao,

 

Thank you for contacting Syncfusion Support.

 

We have checked your query. Please find the response from below table,

 

 

Query 1:

How can i programmatically select entire row when using cell merge feature in sfgrid? I noticed that fromthis link, it stated that "Row selection is not supported". Is there any workaround for this issue?

 

We regret to inform that it’s not possible for row selection in merge cell feature in SfDataGrid. You can use Cell selection instead of Row.

 

Query 2:

I have row style and alternating row style for my grid, when using cell merge, how can i style the cell according to the merged cell? As you can see from the attached sample(taking row 3 as example), column 1 to 8 are merge and the background color should be the same (should be both white), and column 9 and 10 are not merge so it is correct to have different color.

 

If you want to apply the style for merge cell, then you can use ColumnBase.IsSpannedColumn property to customize the style of GridCell as like below code. In the below attached sample, we have applied the alternate row style and GridCell style for merge cell. Could you please refer to it.

 

Code Snippet:

 

public class SelectorClass : StyleSelector

{

    public override Style SelectStyle(object item, DependencyObject container)

    {

        var data = item as OrderInfo;

        if (data != null && ((container as GridCell).ColumnBase.GridColumn != null))

        {

            if ((container as GridCell).ColumnBase.IsSpannedColumn)

                return App.Current.Resources["redCellStyle"] as Style;               

        }

        return base.SelectStyle(item, container);

    }

}

 

 

Sample: http://www.syncfusion.com/downloads/support/forum/131589/ze/CellMergeDemo-574424378

 

Please let us know if you have any query.

 

Regards,

Muthukumar K


BAO YADONG
Replied On July 24, 2017 10:50 AM UTC

Hi, your solution doesn't seems to work on my issue. i have attached another image for your reference. Thanks.

Looking forward for your assistant.


Attachment: Untitled_273ec25d.rar

Muthukumar Kalyanasundaram [Syncfusion]
Replied On July 25, 2017 06:39 PM UTC

Hi Bao, 

Thanks for the update. 

We have checked your provided snapshot. Based on this, we have prepared sample. In that, we have applied the GridCell style for merged cell because if you apply the alternate rowstyle, the merged cell also alternate style will be applied. To avoid alternate row color for merge cell, you can apply GridCell style. For your reference, we have attached image and snaphot. Could you please refer to it. 

 


Please let us know if you have any query. 

Regards, 
Muthukumar K 


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

;