I have at WPF app with a main window using MVVM and EF.
In the MainView I have RadGridView with a GridViewComboBoxColumn that is bound to a property on my model,
I would like to use it with a Enum when the user want to edit the value.
XAML in MainView
<Window>
<UserControl.DataContext>
<viewModel:MainViewModel/>
</UserControl.DataContext>
<Grid>
<telerik:RadGridView ItemsSource="{Binding MyUserList}">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="ID"
DataMemberBinding="{Binding Id}"
IsReadOnly="True" />
<telerik:GridViewComboBoxColumn DataMemberBinding="{Binding UseName}"
ItemsSource="{Binding AvailableUserNameEnum}"
UniqueName="UseTheName"
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</Grid>
</Window>
Code in MainViewmodel
public enumUseNameEnum
{
NA,
No,
Yes
}
public List<UseNameEnum> AvailableUseNameEnum { get; set; }
private void Fill AvailableUseNameEnums()
{
AvailableUseNameEnum = new List<UseNameEnum>
{
UseNameEnum.Yes,
UseNameEnum.No,
UseNameEnum.NA
};
}
Data from the Table
User is hold the this list, that is bound to the grid:
public ObservableCollection<Users> MyUserList { get; set; }
Table User
has 2 Columns: ID and UseName
The Grid
shows data fine, except for the UseName Column, that is blank. When clicked in the combobox , it has data ,
the 3 options, but when one is selected
the values is not showing in the cell. It is still blank.