绑定枚举体到ComboBox的简单实现

 1         private GroupType _selectedMyEnumType;
 2 
 3         public GroupType SelectedType
 4         {
 5             get { return _selectedMyEnumType; }
 6             set
 7             {
 8                 _selectedMyEnumType = value;
 9                 RaisePropertyChangedEvent("SelectedMyEnumType");
10             }
11         }
12 
13         public IEnumerable<GroupType> GroupTypes
14         {
15             get
16             {
17                 return Enum.GetValues(typeof(GroupType))
18                     .Cast<GroupType>();
19             }
20         }    
<ComboBox  
                      ItemsSource="{Binding GroupTypes}"
                      SelectedItem="{Binding SelectedType}" />

GroupType为Enum

原文地址:https://www.cnblogs.com/movingcity/p/2933662.html