开发者

WPF binding combobox to nested enum in different namespace works not in Designer

开发者 https://www.devze.com 2023-02-03 05:41 出处:网络
I have the following definition in my xaml f开发者_如何转开发ile to bind a combobox to a nested enum:

I have the following definition in my xaml f开发者_如何转开发ile to bind a combobox to a nested enum:

<Window xmlns:myns="clr-namespace:Company.Project1.Component1.SubComp1;assembly=Project1.Component1">
<Window.Resources>
    <ObjectDataProvider x:Key="testEnum"
                        MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
        <ObjectDataProvider.MethodParameters>
            <x:Type TypeName="myns:Class+NestedEnum" />
        </ObjectDataProvider.MethodParameters>
    </ObjectDataProvider>

This works fine, however I get the error message "The type 'Class+NestedEnum' was not found" and the Designer won't load the file.

How do I have to do the binding of the enum to the comb obox, so that the Designer works as well? Thanks.

EDIT: I'm using VS2008


I have the same problem.
This is a known bug : http://social.msdn.microsoft.com/Forums/en-NZ/vswpfdesigner/thread/ea668b28-636b-4f99-b1e7-49dc4d98b263
I hope this will be fix in the next Visual Studio (2012).
I think you used the best solution : removing the enum from the class.

0

精彩评论

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

关注公众号