无法在WF4中的Combobox中显示枚举

Nae*_*ael 1 wpf xaml

我试图在我的WF4项目中遵循这篇文章中的解决方案:将枚举属性数据绑定到WPF中的ComboBox

我已经实现了代码

<ObjectDataProvider MethodName="GetValues"
    ObjectType="{x:Type s:Enum}"
    x:Key="DayOfWeekValues">
    <ObjectDataProvider.MethodParameters>
        <x:Type TypeName="s:DayOfWeek" />
    </ObjectDataProvider.MethodParameters>
</ObjectDataProvider>

<ComboBox ItemsSource="{Binding Source={StaticResource DayOfWeekValues}}"/>
Run Code Online (Sandbox Code Playgroud)

我在TypeName ="s:DayOfWeek"属性上收到以下错误.

Cannot reparent the node "Type(System.DayOfWeek)" from the old parent "IList" to the new parent "ObjectDataProvider".
Run Code Online (Sandbox Code Playgroud)

有关此错误含义的任何想法?

编辑:除了上面的错误,我还在ObjectDataProvider上的MethodName ="GetValues"属性上收到以下错误.

INCORRECT_PARAMETER_TYPE
Run Code Online (Sandbox Code Playgroud)

Lou*_*hys 5

只需重建(不构建)解决方案或重建项目,它就可以正常工作.