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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use ComboBoxAdv in GridControl

Thread ID:

Created:

Updated:

Platform:

Replies:

150522 Jan 9,2020 05:50 PM UTC Feb 10,2020 01:31 PM UTC WPF 22
loading
Tags: GridControl
Krzysztof
Asked On January 9, 2020 05:51 PM UTC

How to use ComboBoxAdv in GridControl

Sorry for my English. Google Translate ...

I know how to create ComboBoxAdv and bind data.

However, I don't know how to properly connect ComboBoxAdv to GridControl to have

- the ability to attach data as for (e.Style.ItemsSource = concect) or similar
through

gridControl.Model.QueryCellInfo + = new Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventHandler (gridControl_QueryCellInfo);
  void gridControl_QueryCellInfo (object sender, Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventArgs e)
{
....
 e.Style.CellType = "ComboBoxAdvSynfusion";
                                e.Style.CellItemTemplateKey = "ComboBoxAdvSynfusionTemplate";
....
}
- Each ComboBoxAdv with different data for each cell
- ComboBoxAdv with multi select
- data separator ', ' (leak and space)
- validation of selected data (string length 50)
if the exception is a message in a balloon and that when the data is selected, validation occurs because each element is selected and deselected, and that the selected element is marked as well as changing the style of elements that can no longer be included due to the restriction (string lenght 50)

- the original input is DataTable with 1 data column or processed into List

Will you help me?

Arulpriya Ramalingam [Syncfusion]
Replied On January 10, 2020 01:27 PM UTC

Hi Krzysztof, 
 
Greetings from syncfusion. 
 
We could understand your requirements and we need to check the possibilities to implement it our end. So, we have forwarded the query to our development team for further investigation and update you the proper details on 14th January, 2020. Please get back to us, if you need any assistance in the meanwhile. 
 
Regards, 
Arulpriya 


Krzysztof
Replied On January 10, 2020 03:40 PM UTC

Thank you, I'll be waiting.
Ps. Ultimately, I would like these cells to work as Virtual cell, because there are a lot of data, validation, commenting and coloring rules. The yield is average with 3k rows and 300 columns

Krzysztof
Replied On January 10, 2020 06:54 PM UTC

I have not added important information: Please help for WPF

Arulpriya Ramalingam [Syncfusion]
Replied On January 13, 2020 12:32 PM UTC

Hi Krzysztof, 
 
Thank you for the update. 
 
We are validating the possibilities to achieve the reported requirements at our end and we will update you the proper details on 14th January, 2020 as we promised. 
 
Regards, 
Arulpriya 


Arulpriya Ramalingam [Syncfusion]
Replied On January 14, 2020 04:27 PM UTC

Hi Krzysztof, 
 
Thank you for your patience. 
 
We have created a simple sample as per your requirement by creating a custom cell renderer for DataTemplate. Please make use of below sample and UG link for further details. 
 
 
Please get back to us, if you have any other queries. 
 
Regards, 
Arulpriya 


Krzysztof
Replied On January 14, 2020 05:55 PM UTC

Hello
Thank you for your sample, but I have a problem with
usingSystem.Windows.Interactivity;
I can't solve the problem.
I'm trying to apply:
https://devblogs.microsoft.com/dotnet/open-sourcing-xaml-behaviors-for-wpf/

However, this fails. Any advice? I'm using VS 2019

Arulpriya Ramalingam [Syncfusion]
Replied On January 15, 2020 11:52 AM UTC

Hi Krzysztof, 
 
Thank you for the update. 
 
The assembly can be found in your local machine from the below location moreover, we have modified the sample by removing all the unnecessary assemblies from the demo. Please make use of the modified sample. 
 
Assembly location: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions  
 
Please get back to us, if you have any other queries. 
 
Regards, 
Arulpriya 


Krzysztof
Replied On January 15, 2020 10:17 PM UTC

Hello
Thanks for the quick reply.

However, the solution does not completely solve my problem.

- the ability to attach data as for (e.Style.ItemsSource = concect)

In other words, with one data validation and ComboBoxAdv visual style but with different ItemsSource depending on komuraki (col index and cell index)

E.g. I have 3 columns of 10 rows, each of the cells is ComboBoxAdv Multi but only the ItemsSource is different, each data set can be different and is dynamic so I can't create classes for each ItemsSource

Thus, I have no idea how to process the example sent to achieve what I want.

It's best for me to set ItemsSource right after setting CellType and CellItemTemplateKey

       if (e.Cell.RowIndex> 0 && e.Cell.ColumnIndex == 2)
             {
                 e.Style.CellType = "DataTemplate";
                 e.Style.CellItemTemplateKey = "ComboBoxTemplate";
/* somewhere here */

             }

Arulpriya Ramalingam [Syncfusion]
Replied On January 18, 2020 07:38 AM UTC

Hi Krzysztof, 
 
Thank you for the update. 
 
We have validated the possibilities to bind different ItemsSource for each cells however, the custom cell renderer uses the ContentControl which does not have support for ItemsSource. So, we regret to let you know that the custom combobox does not have any possibilities to bind different collection for each cells. 
 
Please get back to us, if you have any other queries. 
 
Regards, 
Arulpriya 


Krzysztof
Replied On January 19, 2020 06:40 PM UTC


Arulpriya Ramalingam [Syncfusion]
Replied On January 20, 2020 01:02 PM UTC

Hi Krzysztof, 
 
Thank you for the update. 
 
We have validated the scenario that initializing the ComboBox when the cell click is occurred. This use case could not be achieved since, the elements and DataTemplates will not be updated however, we have modified the sample to add different ItemsSource for each cells by creating a custom renderer from CustomComboBox. Please make use of below sample and let us know the use cases with simple screenshot which are not working properly at your end. So that, we could analyze further to provide a better solution at the earliest. 
 
 
Regards, 
Arulpriya 


Krzysztof
Replied On January 20, 2020 07:03 PM UTC

Hello
The latest version works (hooking ItemsSource).
However, it has a bug, previous versions also contained a bug.

Add more columns and rows (60,60) so that scrolling works, then set several columns as combobox, after starting the program, click a few combobox to set values and start scrolling right, left so that the cells disappear from the field of view and return - the values change the cells automatically .

Ps. Previous post pasted with google translate and something more pasted than should you see it?

Attachment: scroll_86bb6444.zip

Arulpriya Ramalingam [Syncfusion]
Replied On January 21, 2020 01:53 PM UTC

Hi Krzysztof, 
 
Thank you for the update. 
 
We could understand the use case and forwarded the scenario to our development team for further analysis. So, we need some more time to validate on this and update you the proper details on 23rd January, 2020. 
 
Regards, 
Arulpriya 


Arulpriya Ramalingam [Syncfusion]
Replied On January 23, 2020 05:03 PM UTC

Hi Krzysztof,  
 
Sorry for the inconvenience. 
 
We have validated the reported scenario at our end it occurred due to adding the ItemsSource for each ComboBox dynamically. Moreover, we have checked all the possibilities to achieve this scenario and we regret to let you know that the grid does not have any extensions to meet the dynamic  items source binding and we request you to use the solution provided on 15th January, 2020 to add a multiselect combobox in grid cells. 
 
Please get back to us, if you have any other queries. 
 
Regards, 
Arulpriya 


Krzysztof
Replied On January 24, 2020 11:00 AM UTC

Hello
I am extremely disappointed that this is not done, and I thought that your tool so complex will not have a problem with it. I am inclined to conclude that since there is a problem with ComboBoxADV (and it is yours) then really with all other unusual controls connected to GridControl will be the same problem. So someone has not developed something or it is a mistake in your basic mechanism.
Is there a chance that the problem will be solved / fixed? Otherwise, I am forced to look for another solution = competition.

Krzysztof
Replied On January 24, 2020 07:07 PM UTC

I just noticed that the problem of data incontinence in cells after scrolling also occurs in the first version of your solution. So something more is wrong.

Arulpriya Ramalingam [Syncfusion]
Replied On January 27, 2020 01:12 PM UTC

Hi Krzysztof, 
 
Thank you for the update. 
 
As we updated earlier, the GridControl does not have any extensible support to update the ItemsSource for a control in a cell. However, the SfDataGrid have the support to add custom cell type with ComboBoxAdv with dynamic binding source by creating a custom cell renderer. We have created a simple sample as per your requirement and the please make use of below sample and UG link for further reference. 
 
 
Moreover, the dynamic ItemsSource for the combobox can be achieved by implementing the ItemsSourceSelector interface. Please refer to the below UG for further details. 
 
Note: In the provided sample, the CustomerName is combobox column with multi select option. 
 
Please get back to us, if you have any other queries. 
 
Regards, 
Arulpriya 


Krzysztof
Replied On February 4, 2020 01:28 PM UTC

Hello
Your solution is not what I expect.
Because all of my data is dynamic (and I have to program all exceptions manually), I can't do a Model or ViewModel class because my input is different, different numbers of columns, and different data in different columns. I can't define class constants because only when I load the data do I know what data I will get. likewise, I can't have static data binding in xaml only programmatically in code.

Arulpriya Ramalingam [Syncfusion]
Replied On February 5, 2020 01:41 PM UTC

Hi Krzysztof, 
 
Thank you for the update. 
 
We could understand the use case and we need some more time to validate further. So, we will update you the details on 06th February, 2020. 
 
Regards, 
Arulpriya 


Arulpriya Ramalingam [Syncfusion]
Replied On February 7, 2020 05:37 AM UTC

Hi Krzysztof,  
 
Thank you for your patience. 
 
As we updated earlier, the GridControl does not have the support add a ComboBoxAdv column and the SfDateGrid have the support to bind the source at run time. You can add the columns dynamically in DataGrid. Initially you need to set the ItemsSource as one collection. Here we have set the data table as ItemsSouce in dataGrid loaded event And then we have add the column dynamically in button click, Please check the below code, 
C#: 
  private void DataGrid_Loaded(object sender, RoutedEventArgs e) 
  { 
      this.DataGrid.AutoGenerateColumns = false; 
      this.DataGrid.ItemsSource = dt; 
 
      DataTemplate cellTemplate = new DataTemplate(); 
      FrameworkElementFactory frameworkElement = new FrameworkElementFactory(typeof(ComboBox)); 
      Binding displayBinding = new Binding() { Path = new PropertyPath("EmployeeID") }; 
      frameworkElement.SetValue(ComboBox.ItemsSourceProperty, customerCollection); 
      frameworkElement.SetValue(ComboBox.DisplayMemberPathProperty, "ID"); 
      frameworkElement.SetValue(ComboBox.SelectedValueProperty, displayBinding); 
      cellTemplate.VisualTree = frameworkElement; 
      this.DataGrid.Columns.Add(new GridTemplateColumn() { MappingName = "EmployeeID", CellTemplate = cellTemplate }); 
 
 
      DataTemplate cellTemplate1 = new DataTemplate(); 
      FrameworkElementFactory frameworkElement1 = new FrameworkElementFactory(typeof(ComboBox)); 
      Binding displayBinding1 = new Binding() { Path = new PropertyPath("EmployeeName") }; 
      frameworkElement1.SetValue(ComboBox.ItemsSourceProperty, customerCollection); 
      frameworkElement1.SetValue(ComboBox.DisplayMemberPathProperty, "Name"); 
      frameworkElement.SetValue(ComboBox.SelectedValueProperty, displayBinding1); 
      cellTemplate1.VisualTree = frameworkElement1; 
      this.DataGrid.Columns.Add(new GridTemplateColumn() { MappingName = "EmployeeName", CellTemplate = cellTemplate1 }); 
 
      this.DataGrid.Columns.Add(new GridTextColumn() { MappingName = "Destination" }); 
 
  } 
 
  private void AddColumns_Click(object sender, RoutedEventArgs e) 
  { 
      dt.Columns.Add("EmployeeAge", typeof(int)); 
 
      foreach (System.Data.DataRow row in dt.Rows) 
      { 
          row[3] = r.Next(25, 30); 
      } 
      this.DataGrid.Columns.Add(new GridTextColumn() { MappingName = "EmployeeAge" }); 
      this.DataGrid.ItemsSource = dt; 
  } 
 
 
Please check the sample and let us know if you need further assistance on this. 
 
Regards, 
Arulpriya 


Krzysztof
Replied On February 9, 2020 10:27 AM UTC

Hello, thanks for the quick help though,
this is still not a solution to my problem, there is also a limitation that all cells in one column are of the same type, and combobox has the same itemsource, and one validation for the entire column.
I don't think I understand something.

Arulpriya Ramalingam [Syncfusion]
Replied On February 10, 2020 01:31 PM UTC

 
Thank you for the update. 
 
The SfDataGrid have the built-in support for different cell validation and itemsource for each cells. We already provided the details in our user guide and please refer to the below UG links for further details. 
 
UG link:  
To Load different itemsSource 
To add cell validation 
 
Please get back to us, if you have any other queries. 
 
Regards, 
Arulpriya 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon