GridViewComboBoxColumn SelectedValue based on RadGridView ItemsSource

2 posts, 0 answers
  1. Max
    Max avatar
    27 posts
    Member since:
    May 2013

    Posted 23 May 2013 Link to this post

    I have a RadGridView which contains GridViewComboBoxColumn as column.

    Let consider RadGridView having ItemsSource as ObservableCollection<Product> and GridViewComboBoxColumn ItemsSource is List.

    I want to set the GridViewComboBoxColumn SelectedItem property based on property in RadGridView ItemsSource i.e based on ProductTypeId in item/row/Product of ItemsSource/ObservableCollection<Product>.

    However Product class has property ProductTypeId of type int and not ProductType object as property.

    So how can I set GridViewComboBoxColumn SelectedItem so that it display value of Product.ProductTypeId as selected. And also I want to bind SeletedItem with Mode = TwoWay so that whenever ComboBox SelectedItem changes it will be reflected in RadGridView 
    's ItemsSource.

    One more thing the ProductId name is different in Product (Bound to RadGridView) class as well as ProductType class. However I can change this to be the same. Current it's like ProductType.Id and Product.TypeId.

    Any help would be much appreciated.

    Thanks.

  2. Max
    Max avatar
    27 posts
    Member since:
    May 2013

    Posted 23 May 2013 Link to this post

    Okay I found solution. Here is link for the same.

    http://www.telerik.com/community/forums/wpf/gridview/gridviewcomboboxcolumn-datamemberbinding.aspx

    Thanks to Maya. :)
Back to Top