开发者

Trouble displaying Enums in a Combobox in WF4

I'm trying to follow the solution from this post in my WF4 project: Databinding an enum property to a ComboBox in WPF

And I've implemented the code

<ObjectDataProvider MethodName="GetValues"
    ObjectType="{x:Type s:Enum}"
    x:Key="DayOfWe开发者_StackOverflowekValues">
    <ObjectDataProvider.MethodParameters>
        <x:Type TypeName="s:DayOfWeek" />
    </ObjectDataProvider.MethodParameters>
</ObjectDataProvider>

<ComboBox ItemsSource="{Binding Source={StaticResource DayOfWeekValues}}"/>

I'm getting the following error on the TypeName="s:DayOfWeek" property.

Cannot reparent the node "Type(System.DayOfWeek)" from the old parent "IList" to the new parent "ObjectDataProvider".

Any ideas about what this error means?

EDIT: In addition to the error above, I'm also getting the following error on the MethodName="GetValues" property on the ObjectDataProvider.

INCORRECT_PARAMETER_TYPE


Just rebuild (not build) the solution or rebuild the project and it will work just fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜