I have an ObservableCollection that holds collection of User
class User
{
public int Id{ get; set; }
public UserType UserType{ get; set; }
}
and an enum
enum UserType
{
Admin,
Moderator,
User,
Guest
}
and then I have a mapper for the enum called UserTypeMap that can be accessed from ViewModel
public class UserListViewModel : INotifyPropertyChanged
{
......
public ObservableCollection<User> Users
{
get{ return this.users; }
set{ this.users = value; this.InvokePropertyChanged( "Users" );
}
public IDictionary<UserType, string> UserTypeMap{ get; set; }
{
get{ return this.userTypeMap; }
set{ this.userTypeMap= value; this.InvokePropertyChanged( "UserTypeMap" );
}
....
}
on client side, I made a DataGrid that holds list of user
<sdk:DataGrid ItemsSource="{Binding Users}">
<sdk:DataGridTextColumn Binding="{Binding Id}" Header="ID"/>
<sdk:DataGridTextColumn Binding="{**??????????**}" Header="Type"/>
</sdk>
I don't know how to bind dictionary value to DataGridTextColumn, I tried to use combobox before, using SelectedValue and ItemsSource and it worked, but I want to display it on text box / label, not on combobox...
Is there a pure xaml way (not code behind page) to do this?
Thanks, Will