Using ComboBoxAdv as renderer in SfDataGrid

Hi

I have 2 issues

  1. I can not enable IsEditable when ComboBoxAdv is used as renderer in a SdDataGrid column.

I've followed documentation https://help.syncfusion.com/wpf/datagrid/column-types#custom-column-support

I've tried also to add some DependencyProperty (see attached code) but i've not foud a solution.


2. I don't know how to set SelectedItems = null for an empty cell

When i select 2 items in a cell (A) and after select another cell (B), in (B) cell the 2 items previously selected in (A) are still selected in the list of (B).


Furthermore:

There is a strange behavior of ComboBoxAdv (when it is used as cell renderer) when AllowMultiSelect is implemented with a DependencyProperty.

The ItemTemplate is not well rendered when EnableToken is set to true.


I'm working programmatically, please, avoid response using XAML

Thanks in advance


Regards

Michele





Attachment: ComboCheckBoxColumn_87d556ec.zip


7 Replies 1 reply marked as answer

VS Vijayarasan Sivanandham Syncfusion Team October 18, 2021 03:01 PM UTC

Hi Michele,

Thank you for contacting Syncfusion Support.

Currently, we are analyzing your provided sample at our end. We will validate and update you the details on or before October 20, 2021.

We appreciate your patience until then.

Regards,
Vijayarasan S



VS Vijayarasan Sivanandham Syncfusion Team October 20, 2021 04:27 PM UTC

Hi Michele,

We regret for inconvenience.

We are still working on this. We will update with further details on or before October 22, 2021. We appreciate your patience and understanding.

Regards,
Vijayarasan S



MI Michele October 21, 2021 06:30 AM UTC

Hi  Vijayarasan

I understand, no problem


Thanks

Michele



VS Vijayarasan Sivanandham Syncfusion Team October 22, 2021 06:16 PM UTC

Hi Michele,

We deeply regret for the delay and inconvenience caused.

Please find answer for your queries below 
Queries 
Solutions 
 
I can not enable IsEditable when ComboBoxAdv is used as renderer in a SdDataGrid column. 
I've followed documentation  
 
I've tried also to add some DependencyProperty (see attached code) but i've not foud a solution. 
 

Based on provided information we suspect that your application IsEditable and AllowMultiSelect both property enabled in ComboBoxAdv. In this case editing not enable in ComboBoxAdv. We regret to inform you that we cannot enable the editing while AllowMultiSelect enabled case. This is behavior of ComboBoxAdv control.



 

I don't know how to set SelectedItems = null for an empty cell
 
 
When i select 2 items in a cell (A) and after select another cell (B), in (B) cell the 2 items previously selected in (A) are still selected in the list of (B).  
 
Furthermore: 
 
There is a strange behavior of ComboBoxAdv (when it is used as cell renderer) when AllowMultiSelect is implemented with a DependencyProperty. 
 
The ItemTemplate is not well rendered when EnableToken is set to true. 
 
 
 
I'm working programmatically, please, avoid response using XAML 
 


Based on provided information your requirement some condition not satisfied based on your scenario in when ComboBoxAdv is used as renderer in a SfDataGrid column. You can solve the reported problem by loaded the ComboBoxAdv as CellTemplate in GridTemplateColumn.

Sample Link: https://www.syncfusion.com/downloads/support/forum/169700/ze/ComboCheckBoxColumn56504329

For more information related to GridTemplateColumn, please refer the below UG link,
 
 
 
 

Please let us know if you have any concerns in this.

Regards,
Vijayarasan S 



MI Michele October 25, 2021 10:11 AM UTC

Thanks Vijayarasan 


Using your sample:  https://www.syncfusion.com/downloads/support/forum/169700/ze/ComboCheckBoxColumn56504329

 I can not achive my needs.


I need:

ComboBoxAdv .ItemsSource must be bound to ObservableCollection<Person> Persons

ComboBoxAdv .SelectedItems must be bound to ObservableCollection<Person> Children


In that way i would like to add or remove items in Person.Children using ComboBoxAdv.


Code that you provided doesn't bind correctly to Children


As you can see in picture below, in MainWindow, Pino has a child Mario, but isn't true in SelectedItem Children Collection .

p.JPG


So, 

How can i bind Children to ComboBoxAdv.SelectedItems?

How set  ComboBoxAdv as EditTemplate and show SelectedItems as List in a TextBox in CellTemplate?


Thanks

Michele




MI Michele replied to Michele October 25, 2021 11:30 AM UTC

Using this code i've match my needs.


            var cellTemplate = getTemplate();

            var editTemplate = getEditTemplate();

            this.grid.Columns.Add(new GridTemplateColumn() { HeaderText = "Children", MappingName = "Children",AllowEditing = true,CellTemplate=cellTemplate, EditTemplate = editTemplate, SetCellBoundValue= false });


        private DataTemplate getTemplate()

        {

            DataTemplate editTemplate = new DataTemplate();


            FrameworkElementFactory textBlokFE = new FrameworkElementFactory(typeof(TextBlock));

            textBlokFE.SetValue(TextBlock.PaddingProperty, new Thickness(3,0,2,0));

            textBlokFE.SetValue(TextBlock.VerticalAlignmentProperty, VerticalAlignment.Center);


            Binding textBinding = new Binding() { Path = new PropertyPath("Children"), Mode = BindingMode.OneWay,Converter = new DisplayConverter() };

            textBlokFE.SetValue(TextBlock.TextProperty, textBinding);


            editTemplate.VisualTree = textBlokFE;


            return editTemplate;

        }



        private DataTemplate getEditTemplate()

        {

            DataTemplate editTemplate = new DataTemplate();


            FrameworkElementFactory comboBoxAdvFE = new FrameworkElementFactory(typeof(ComboBoxAdv));


            Binding editBinding = new Binding() { Path = new PropertyPath("Persons"), Source = this, Mode = BindingMode.TwoWay };

            comboBoxAdvFE.SetValue(ComboBoxAdv.ItemsSourceProperty, editBinding);


            var selectedItemsBinding = new Binding { Path = new PropertyPath("Children"), Mode = BindingMode.TwoWay };

            comboBoxAdvFE.SetBinding(ComboBoxAdv.SelectedItemsProperty, selectedItemsBinding);


            var displayMemberBinding = new Binding { Path = new PropertyPath("Name"), Source = this, Mode = BindingMode.TwoWay };

            comboBoxAdvFE.SetValue(ComboBoxAdv.DisplayMemberPathProperty, "Name");


            comboBoxAdvFE.SetValue(ComboBoxAdv.DefaultTextProperty, "Select Childred...");

            comboBoxAdvFE.SetValue(ComboBoxAdv.SelectedValueDelimiterProperty, ";");

            comboBoxAdvFE.SetValue(ComboBoxAdv.AllowMultiSelectProperty, true);

            comboBoxAdvFE.SetValue(ComboBoxAdv.IsEditableProperty, true);

            comboBoxAdvFE.SetValue(ComboBoxAdv.AllowSelectAllProperty, true);


            editTemplate.VisualTree = comboBoxAdvFE;


            return editTemplate;

        }





Marked as answer

VS Vijayarasan Sivanandham Syncfusion Team October 26, 2021 05:30 AM UTC

Hi Michele,

Thanks for the update.

We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you😊.

Regards,
Vijayarasan S

Loader.
Up arrow icon