Guy P
Guy P

Reputation: 1423

Unable to show BindingMode Enum in comboBox (WPF)

I'm trying to show the original BindingMode enum in a comboBox (the list of TwoWay`OneWay` etc.).

In the XAML file, inside Resources I need to set ObjectDataProvider to be the type of BindingMode:

<!--BindingMode combo box-->
<ObjectDataProvider x:Key="BindingMode" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
    <ObjectDataProvider.MethodParameters>
        <x:Type TypeName="sys:BindingMode"/>
    </ObjectDataProvider.MethodParameters>
</ObjectDataProvider>

The problem is that I can't include System.Windows.Data in 'xmlns', i've tried to declare:

xmlns:sysWinData="clr-namespace:System.Windows.Data;assembly=mscorlib"

but it won't work. What am I missng here? Thanks.

Upvotes: 0

Views: 64

Answers (1)

Rohit Vats
Rohit Vats

Reputation: 81333

System.Windows.Data resides in PresentationFramework.dll so change your declaration to

xmlns:sysWinData="clr-namespace:System.Windows.Data;assembly=PresentationFramework"

Upvotes: 2

Related Questions