Hallo ich eine Enumeration mit Beschreibungen zu einer Combobox binden möchten:WPF Wie eine Enumeration mit Beschreibungen zu einer Combobox binden
ich nächste Enum bekam:
: diesespublic enum ReportTemplate
{
[Description("Top view")]
1,
[Description("Section view")]
2
}
Ich habe versucht,
<ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type System:Enum}"
x:Key="ReportTemplateEnum">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="Helpers:ReportTemplate" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<Style x:Key="ReportTemplateCombobox" TargetType="dxe:ComboBoxEditSettings">
<Setter Property="ItemsSource"
Value="{Binding Source={x:Type Helpers:ReportTemplate}}"/>
<Setter Property="DisplayMember" Value="Description" />
<Setter Property="ValueMember" Value="Value" />
</Style>
Kann es nicht schaffen, dies zu tun 1 kennt eine einfache Lösung?
Vielen Dank im Voraus!
Für ein alternativer Ansatz siehe http://stackoverflow.com/questions/9242345/show-enum-in-a-combobox/9327548#9327548 – Phil