将枚举属性数据库为WPF中的组合框
public enum ExampleEnum { FooBar, BarFoo }public class ExampleClass : INotifyPropertyChanged{
private ExampleEnum example;
public ExampleEnum ExampleProperty
{ get { return example; } { /* set and notify */; } }}<ComboBox ItemsSource="What goes here?" SelectedItem="{Binding Path=ExampleProperty}" />编辑
<Window.Resources>
<ObjectDataProvider MethodName="GetValues"
ObjectType="{x:Type sys:Enum}"
x:Key="ExampleEnumValues">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="ExampleEnum" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider></Window.Resources><ComboBox ItemsSource="{Binding Source={StaticResource ExampleEnumValues}}"/>
12345678_0001
红糖糍粑
莫回无
随时随地看视频慕课网APP