This is a migrated thread and some comments may be shown as answers.

CellEditTemplate Binding is not working

1 Answer 169 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dharmavaram
Top achievements
Rank 1
Dharmavaram asked on 02 Aug 2017, 05:23 AM

Hi I am having combobox in the GridViewData column and i am binding the ItemSource with one  of the property present on the class binded to the radgridview itemsource collection.For example I binded radgridview with list of employees.Employee is a class and I binded the combobox itemsource with dependants property which is one of the property on the employee class.

But the combobox is not populating.DataContext of RadGridView is separate and it is another viewmodel class.

 

<telerik:GridViewDataColumn.CellEditTemplate>
                       <DataTemplate>
                           <telerik:RadComboBox x:Name="ComboBox"  SelectedIndex="0"  Height="20" Width="150"
                            ItemsSource="{Binding Items,RelativeSource={RelativeSource AncestorType=telerik:GridViewRow}}"
                            ItemTemplate="{StaticResource RadComboBoxItemTemplate}"
                            SelectionBoxTemplate="{StaticResource SelectionBoxTemplate}">
                           </telerik:RadComboBox>
                       </DataTemplate>
                   </telerik:GridViewDataColumn.CellEditTemplate>

 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 04 Aug 2017, 12:08 PM
Hello Dharmavaram,

Generally speaking, the GridViewRow element does not expose an Items property. Thus, such binding is expected not to be working. In case I am not missing anything, you should be able to defined the needed binding by setting it to the GridViewRow.DataContext property. It represents the bound item. Can you please give it a try? Is this the behavior you are aiming at?

Regards,
Stefan X1
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Dharmavaram
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or