This question is locked. New answers and comments are not allowed.
How can we set the itemsource for a gridviewcomboxcolumn from xaml?
The context of the parent grid has a collection property which needs to be set as the itemsource.
Can we do this from xaml?
http://www.telerik.com/help/silverlight/gridview-gridviewcomboboxcolumn.html
Thanks
Jay
The context of the parent grid has a collection property which needs to be set as the itemsource.
Can we do this from xaml?
http://www.telerik.com/help/silverlight/gridview-gridviewcomboboxcolumn.html
| XAML | Copy Code |
|---|---|
|
<telerik:RadGridView x:Name="RadGridView1" AutoGenerateColumns="False" >
<telerik:RadGridView.Columns> <telerik:GridViewComboBoxColumn HeaderText="Country" SelectedValueMemberPath="ID" DisplayMemberPath="Name" DataMemberBinding="{Binding CountryID}" /> … </telerik:RadGridView.Columns> </telerik:RadGridView> |
|
| C# | Copy Code |
|---|---|
|
GridViewComboBoxColumn comboColumn = new GridViewComboBoxColumn();
comboColumn.HeaderText = "Country"; comboColumn.DataMemberBinding = new Binding("CountryID"); comboColumn.ItemsSource = GetCountries(); comboColumn.DisplayMemberPath = "Name"; comboColumn.SelectedValueMemberPath = "ID"; this.RadGridView1.Columns.Add(comboColumn); private System.Collections.IEnumerable GetCountries() { List<Country> countries = new List<Country>(); countries.Add(new Country(){ID=0, Name = "Germany"}); countries.Add(new Country(){ID=1, Name = "Spain"}); countries.Add(new Country(){ID=2, Name = "UK"}); return countries; } |
|
Thanks
Jay
Copy Code