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

Grouping with GridMultiColumnDropDownList

Thread ID:

Created:

Updated:

Platform:

Replies:

121666 Jan 14,2016 05:05 PM UTC May 27,2016 02:11 AM UTC WPF 5
loading
Tags: SfDataGrid
Silvio
Asked On January 14, 2016 05:05 PM UTC

Hi,

I have a SfDataGrid that have a column of type GridMultiColumnDropDownList.

I have these bindings:

ItemsSource="{Binding AuxiliaryCodes.AuxiliaryListValues}"
MappingName="AuxiliaryListValue_ID"
ValueMember="ID"

and these columns:

                        <Syncfusion:GridMultiColumnDropDownList.Columns>
                            <Syncfusion:Columns>
                                <Syncfusion:GridTextColumn MappingName="Code" HeaderText="Code}"  />
                                <Syncfusion:GridTextColumn MappingName="Description" HeaderText="Description"  />
                            </Syncfusion:Columns>
                        </Syncfusion:GridMultiColumnDropDownList.Columns>

The column is binded to an object with a column named "AuxiliaryList_ID" of type int?.
The combo-box is binded to a list of objects that have 2 properties named Code and Description and a ID (used to bind the value).
I use the GridMultiColumnDropDownList to display in the popup grid both the string columns when the user selects an object.
Everything work very good but I have a little problem with grouping.
In fact when I group using this column, I obtain as keys the ID numbers and not the Code value of the selected records that i see in the cells.

I've found this link that explains how to probably solve the problem if I used a GridComboBoxColumn.

https://www.syncfusion.com/kb/3446/how-to-change-the-groupcaptiontext-based-on-display-member-of-the-gridcomboboxcolumn

But I'm not able to figure out how to implement a similar way for the GridMultiColumnDropDownList column.

Can you help me?

Regards,

Silvio

Farjana Parveen Ayubb [Syncfusion]
Replied On January 15, 2016 11:34 AM UTC

Hi  Silvio,

Thank you for contacting Syncfusion support.

We have analyzed your query. You can achieve your requirement “Group Key based on DisplayMemberPath” by setting GroupColumnDescription.Converter property in GroupColumDescrptionCollectionChanged event in SfDataGrid.

Please refer the below code example and sample in the following location:

Code Example(C# - Converter):
   public class GroupcaptionConverterMultiColumnDropDownList : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (!(parameter is GridMultiColumnDropDownList))
                return value;
            var column = parameter as GridMultiColumnDropDownList;
            var record = value as EmployeeInfo;
            var itemsSource = column.ItemsSource as ObservableCollection<CompanyItem>;
            foreach (var item in itemsSource)
            {
                if (record.CountryCode == (item as CompanyItem).CountryCode)
                    return (item as CompanyItem).CountryName;
            }
            return null;
        }
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

Code Example(C# - GroupColumnDescriptionsCollectionChanged):
   void GroupColumnDescriptions_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                var group = e.NewItems[0] as GroupColumnDescription;
                if (group.ColumnName == "CountryCode")
                    group.Converter = new GroupcaptionConverterMultiColumnDropDownList();
            }
        }

Sample Location: MultiColumnDropDownList_Demo


Please let us know if you required any further assistance.

Regards,
Farjana Parveen A


Silvio
Replied On January 15, 2016 03:07 PM UTC

Thank you very much. It's very clear. I was able to fix my problem very quickly !

Jai Ganesh S [Syncfusion]
Replied On January 18, 2016 05:39 AM UTC

Hi Silvio,

Thank you for the update.

Please let us know if you need further assistance on this.

Regards,
Jai Ganesh S

Silvio
Replied On May 25, 2016 02:50 PM UTC

Hi, 

I have now a problem with this SfDatagrid with combo-box grouping, trying to print it with the "ShowPrintPreview" method.

When I have a grouping on one of these combo-boxes in the grid, and I try to print the grid,
NO converter is called when rendering the grid for the printing.
So I don't obtain what I'd like in the report, that's not the same as I have in the GUI.

Can you help me ?

Srinivasan Vasu [Syncfusion]
Replied On May 27, 2016 02:11 AM UTC

Hi Silvio, 
 
We have analyzed your query and the converter will not be fired while printing SfDataGrid with grouping. But the caption summary row will be printed as like in SfDataGrid without using any converter and for your reference we have attached the PrintPreview image and tested sample. Could you please share more details about the issue? Otherwise modify the attached sample as per your application which will be helpful for us to provide appropriate solution. 
 
Sample and Image Location: Image 
 
Regards,
Srinivasan 
 



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

;