This question is locked. New answers and comments are not allowed.
Let's say we have something like this.
XAML
We create a couple of records and put them into the ItemsSource of a RadGridView. In there we define a ComboBoxColumn. We want an external list of integers as the ItemsSource of the combo box. We "reference" a value from the list which is bound to the ItemsSource of the ComboBox. But it doesn't work at all. I also experience this issue with Enum values (=> value types).
Can somebody tell me why? Is there a reason, that just actual objects work?
using
System.Collections.ObjectModel;
namespace
ComboBoxColumn
{
public
class
Record
{
public
int
Weight {
get
;
set
; }
}
public
partial
class
MainPage
{
public
ObservableCollection<Record> Records {
get
;
set
; }
public
ObservableCollection<
int
> Weights {
get
;
set
; }
public
MainPage()
{
InitializeComponent();
Weights =
new
ObservableCollection<
int
> {10, 50, 100};
Records =
new
ObservableCollection<Record>
{
new
Record
{
Weight = Weights[0]
},
new
Record
{
Weight = Weights[1]
},
};
DataContext =
this
;
}
}
}
XAML
<
UserControl
x:Class
=
"ComboBoxColumn.MainPage"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable
=
"d"
d:DesignWidth
=
"640"
d:DesignHeight
=
"480"
>
<
Grid
x:Name
=
"LayoutRoot"
>
<
telerik:RadGridView
ItemsSource
=
"{Binding Records}"
AutoGenerateColumns
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewComboBoxColumn
ItemsSource
=
"{Binding Path=Weights}"
DataMemberBinding
=
"{Binding Weight}"
Header
=
"Enum"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
Grid
>
</
UserControl
>
We create a couple of records and put them into the ItemsSource of a RadGridView. In there we define a ComboBoxColumn. We want an external list of integers as the ItemsSource of the combo box. We "reference" a value from the list which is bound to the ItemsSource of the ComboBox. But it doesn't work at all. I also experience this issue with Enum values (=> value types).
Can somebody tell me why? Is there a reason, that just actual objects work?