我正在尝试在我的WF4项目中关注此帖子中的解决方案:Databinding an enum property to a ComboBox in WPF
我已经实现了代码
<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}}"/>
我在TypeName =“s:DayOfWeek”属性上遇到以下错误。
Cannot reparent the node "Type(System.DayOfWeek)" from the old parent "IList" to the new parent "ObjectDataProvider".
关于此错误意味着什么的任何想法?
编辑:除了上述错误之外,我还在ObjectDataProvider上的MethodName =“GetValues”属性中收到以下错误。
INCORRECT_PARAMETER_TYPE
答案 0 :(得分:5)
只需重建(不构建)解决方案或重建项目,它就可以正常工作。