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

Data binding ComboBox in GridView

1 Answer 548 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ali
Top achievements
Rank 1
Ali asked on 12 Jan 2018, 01:05 PM

I'm using the combobox in this example inside a grid as a celledittemplate:
<telerik:GridViewDataColumn Header="ŮŽArticle Description" Width="100"><telerik:GridViewDataColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding DataContext.AccDocumentItem.Description1, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadGridView}}}"/></DataTemplate></telerik:GridViewDataColumn.CellTemplate><telerik:GridViewDataColumn.CellEditTemplate><DataTemplate><telerik:RadComboBox IsEditable="True" DisplayMemberPath="SLStandardDescriptionTitle"ItemsSource="{Binding DataContext.AccDocumentItem.SelectedSL.SLStandardDescriptions, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadGridView}}}"Text="{Binding DataContext.AccDocumentItem.Description1,Mode=TwoWay,RelativeSource={RelativeSource AncestorType={x:Type telerik:RadGridView}}}"><i:Interaction.Triggers><i:EventTrigger EventName="DropDownOpened"><i:InvokeCommandAction Command="{Binding DataContext.SLStandardDescriptionsDropDownOpenedCommand, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadGridView}}}" CommandParameter="DLType2"/></i:EventTrigger></i:Interaction.Triggers></telerik:RadComboBox></DataTemplate></telerik:GridViewDataColumn.CellEditTemplate> </telerik:GridViewDataColumn>

I need to present a grid where one column is a combobox. The user can select one value from the list or enter a new value, the problem is that selected row is repeated in all rows. Can you please tell me what I'm doing wrong?
Your time much appreciated!

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 17 Jan 2018, 09:48 AM
Hi Ali,

Thank you for your interest in RadGridView control.

Instead of using GridViewDataColumn and RadComboBox inside it, the RadGridView expose a combobox column which you can use. You can take a look at the ComboBox Column help article in our documentation which describes its properties and how you can populate the column with your data.

Regards,
Dinko
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
Ali
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or