Hi
I have 2 issues
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
Hi Vijayarasan
I understand, no problem
Thanks
Michele
|
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, |
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 .
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
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;
}