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

How to merge cell in row and visual style in WPF

Hello,

i have two simple questions.

1. After new version of syncfusion components, i find out new function about merge cells. Unfortunately i can't find solution for merging cells in row. In my example, i would like to merge rows at last position of DataGrid and merge column C1 + C2 AND C3 + C4 + C5. Solution must have at last position 4 cells (2 merge cells).

2. I have question about styles in syncfusion. I using custom styles for sf:DateTimeEdit (in App.xaml) for choice month and year only. But with using custom style for other components, default visual style for TabControlExt doesn't work. In example you see tabs with Metro visual style, but custom styles this default Tab style replaced. Original Metro style have white font color in tabs, this custom styles changes default color to another, but linking another Metro style in App.xaml doesn't work. 

Thank you very mutch for help

Martin

Attachment: TestWPF_b03b14b.zip

3 Replies

ES Elangovan S Syncfusion Team October 19, 2015 01:41 PM UTC

Hi Martin,

Thank you for contacting Syncfusion Support.

Query 1:

We have analyzed your query, as per your requirement we have merged the columns C1 + C2 and C3 + C4 + C5 based on ColumnIndex by using QueryCoveredRange event trigger. Please find the following code example.


Grid.QueryCoveredRange += Grid_QueryCoveredRange;


void Grid_QueryCoveredRange(object sender, Syncfusion.UI.Xaml.Grid.GridQueryCoveredRangeEventArgs e)

        {

            if (e.RowColumnIndex.ColumnIndex == 2)

            {

                e.Range = new CoveredCellInfo(2, 3, e.RowColumnIndex.RowIndex, e.RowColumnIndex.RowIndex);

                e.Handled = true;

            }

            else if (e.RowColumnIndex.ColumnIndex == 4)

            {

                e.Range = new CoveredCellInfo(4, 6, e.RowColumnIndex.RowIndex, e.RowColumnIndex.RowIndex);

                e.Handled = true;

            }

        }


You can download the sample from the following location:

https://www.syncfusion.com/downloads/support/forum/120820/ze/TestWPF1259879898

Query 2:

A support incident to track the status of this query has been created under your account. Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Regards,

Elangovan S



MT Martin Tichovsky October 20, 2015 04:19 AM UTC

Hello,

Your example is technically good, but i would like merge only last row in the table. For idea, i have data (numbers) in the table, and last row is sumary of C1 + C2 and C3 + C4 + C5. Thank you for help


SR Sivakumar R Syncfusion Team October 20, 2015 11:26 AM UTC

Hi Martin,

You can achieve your requirement by setting Range based on RowIndex in QueryCoveredRange event. Find the code snippet and sample details below,

Code snippet:

void Grid_QueryCoveredRange(object sender, Syncfusion.UI.Xaml.Grid.GridQueryCoveredRangeEventArgs e)

{

    if (Grid.GetLastDataRowIndex() == e.RowColumnIndex.RowIndex)

    {

        if (e.RowColumnIndex.ColumnIndex == 2)

        {

            e.Range = new CoveredCellInfo(2, 3, e.RowColumnIndex.RowIndex, e.RowColumnIndex.RowIndex);

            e.Handled = true;

        }

        else if (e.RowColumnIndex.ColumnIndex == 4)

        {

            e.Range = new CoveredCellInfo(4, 6, e.RowColumnIndex.RowIndex, e.RowColumnIndex.RowIndex);

            e.Handled = true;

        }

    }
}


Image:


Sample:
https://www.syncfusion.com/downloads/support/forum/120820/ze/TestWPF355607939

Thanks,
Sivakumar

Loader.
Live Chat Icon For mobile
Up arrow icon