I am in vb.net with wpf, I have an existing radgridview with custom validationDiffProperty. I am using telerik v 2017.3.1018.45
My goal is to add a radgriview row with radcombox (see attach image). I know how to add a radcombobox column in a radgridview, but I don't know how to add a "radcombobox row" in a radgriview.
Could you please help me ?
5 Answers, 1 is accepted
Thank you for the attached image.
I would recommend you to try using CellTemplateSelector property of the RadGridView columns. There is a CellTemplateSelector help article in our RadGridView documentation which further described this property. In your case, you can create one custom DataTemplateSelector class and applied to every column. Then you can just return the custom DataTemplate with RadComboBox inside only for the first cell.
Thanks for your information, I tried to adapt it a little bit because I can not use like it's descirbed in CellTemplateSelector
I add a new datatemplateselector class like below
I declared it in my xaml (see below)
and I added it to my columns using behind code of the xaml because column are dynamically built (see below)
But I have a pb because the method SelectTemplate of DropDownCellTemplateSelector is never hit, do you have an idea ?
Never mind about my previous post, I made a mistake, I wrote CellEditTemplateSelector instead of CellTemplateSelector, now the radcombobox appear but they are not populate, whereas the list is well filled, and raisePropertyChanged event raised.
Do you know if some trouble coule appear with radcombobox in radgridview ?
Thanks for all, it works, the only thing which doesn't work yet is the assignation of combobox value when radgridview is populated, but I think it's because I use personnal validationDifProperty.
If somemone needs to do the same thing, below you could find the code :
datatemplateSelector class :
xaml file :
I have created a sample project which demonstrates how you can populate the RadComboBox in the first cell of a column. My understanding is that you are struggling with binding the SelectedItem property of every combo box control. After investigating on my side I think I manage to found a possible approach. What you can do is to create a property for every ComboBox in the RadGridView business object. Then you can use bind the SelectedItem property of the RadComboBox to the GridViewCell using RelativeSource and set an IValueConverter class. In the Convert method, you can check the column header and create the binding depending on the name. Check the attached project. When you open the project you can add breakpoints in the setter of the CustomerNameComboBoxValue and CustomerIDComboBoxValue which is fired when you select an item from the comboboxes.