在 WF4 的组合框中显示枚举的问题 [英] Trouble displaying Enums in a Combobox in WF4
本文介绍了在 WF4 的组合框中显示枚举的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在我的 WF4 项目中遵循这篇文章中的解决方案:将枚举属性数据绑定到 WPF 中的组合框
I'm trying to follow the solution from this post in my WF4 project: 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" 属性上收到以下错误.
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?
除了上述错误之外,我还在 ObjectDataProvider 的 MethodName="GetValues" 属性上收到以下错误.
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.
这篇关于在 WF4 的组合框中显示枚举的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文