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.
public
class
Desk
{
public
string
Name {
get
;
set
; }
public
List<Book> Books {
get
;
set
; }
}
public
class
Book
{
public
string
Name {
get
;
set
; }
public
string
Location {
get
;
set
; }
// Other stuff
}
<
telerikGridView:RadTreeListView
x:Name
=
"RadTreeListView1"
AutoGenerateColumns
=
"False"
IsReadOnly
=
"False"
RowIndicatorVisibility
=
"Collapsed"
ItemsSource
=
"{Binding Path=Desks}"
>
<
telerikGridView:RadTreeListView.ChildTableDefinitions
>
<
telerikGridView:TreeListViewTableDefinition
ItemsSource
=
"{Binding Path=Books}"
/>
</
telerikGridView:RadTreeListView.ChildTableDefinitions
>
<
telerikGridView:RadTreeListView.Columns
>
<
telerikGridView:GridViewDataColumn
DataMemberBinding
=
"{Binding Path=Name}"
Header
=
"Name"
Width
=
"150"
/>
<
telerikGridView:GridViewDataColumn
DataMemberBinding
=
"{Binding Path=Description}"
Header
=
"Description"
Width
=
"*"
/>
<
telerikGridView:GridViewDataColumn
DataMemberBinding
=
"{Binding Path=Location.Name}"
Header
=
"Location"
Width
=
"100"
/>
<
telerikGridView:GridViewDataColumn
DataMemberBinding
=
"{Binding Path=Intention}"
Header
=
"Intention"
Width
=
"100"
/>
<
telerikGridView:GridViewDataColumn
DataMemberBinding
=
"{Binding Path=TreatmentType}"
Header
=
"Treatment Type"
Width
=
"100"
/>
<
telerikGridView:GridViewDataColumn
DataMemberBinding
=
"{Binding Path=AccountingTreatment}"
Header
=
"Accounting Treatment"
Width
=
"100"
/>
<
telerikGridView:GridViewDataColumn
DataMemberBinding
=
"{Binding Path=IfrsType}"
Header
=
"Ifrs Type"
Width
=
"100"
/>
</
telerikGridView:RadTreeListView.Columns
>
</
telerikGridView:RadTreeListView
>
<telerikDataViz:RadBarcode39 Name="BarCodeControl" Height="120" Width="425" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Center" Text="90321331" ShowChecksum="False"/>