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

How to bind gridviewcombocolumn to list of classes

1 Answer 48 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Erik Van Norstrand
Top achievements
Rank 1
Erik Van Norstrand asked on 02 Sep 2010, 05:43 PM
I am working on a project currently where I need to be able to bind a combobox column to a list of classes, and I am unable to get the data to display. I had this working in Winforms but for the life of me, I can't get it to work in WPF.

Here is what I have so far.

List<OrganizationNameType> orgTypeList = new List<OrganizationNameType>();
            orgTypeList = hub.OrganizationNameType.ToList();
 
            Telerik.Windows.Controls.GridViewComboBoxColumn gvc = new Telerik.Windows.Controls.GridViewComboBoxColumn();
            gvc.Header = "New Data Types";
            gvc.ItemsSource = orgTypeList;
            gvc.DisplayMemberPath = "TypeName";
            gvc.SelectedValueMemberPath = "TypeName";

In the class OrganizationNameType I am trying to recover the variable "TypeName" of each OrganizationNameType and have it displayed as a column in my RadGrid.

Any ideas/help would be much appreciated.

Thanks!
Erik Van Norstrand

1 Answer, 1 is accepted

Sort by
0
Erik Van Norstrand
Top achievements
Rank 1
answered on 02 Sep 2010, 06:01 PM
This fixed the issue.

Telerik.Windows.Controls.GridViewComboBoxColumn gvc = new Telerik.Windows.Controls.GridViewComboBoxColumn();
            gvc.DataMemberBinding = new Binding("OrganizationNameType");
            gvc.Header = "New Data Types";
            gvc.DisplayMemberPath = "TypeName";
            gvc.ItemsSource = orgTypeList;

Forgot to add the datamemberbinding.
Tags
GridView
Asked by
Erik Van Norstrand
Top achievements
Rank 1
Answers by
Erik Van Norstrand
Top achievements
Rank 1
Share this question
or