Is it a bug in Visual Studio 2008 in WPF Designer when binding to enum defined inside of class?


  • Hello,


    I have following problem:

    when defining an enumeration inside of class (either static class or not) I can bind to this enum, however the WPF Designer inside Visual Studio does not display designed GUI anymore and show an error Type "MyClass+MyEnum" was not found.

    However I can compile and execute the code and in the combobox all enum- values are listed.


    Code behind:

        public class MyClass
            public enum MyEnum { enumValue01, enumValue02, enumValue03, enumValue04, enumValue05 }


    My xaml-code:

    <Window x:Class="SampleBindingOfNestedEnumToComboBox.Window1"
        Title="Window1" Height="300" Width="300">

            <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="odp">
                    <x:Type TypeName="local:MyClass+MyEnum"/>
            <ComboBox  ItemsSource="{Binding Source={StaticResource odp}}"/>

    As I mentioned I can compile and execude thos code, however in VS Designer I just see warning message  "Problem Loading the document contains errors that must be fixed  before the designer can be loaded..."

    When I click on Reload the designer I get following message:

    Error    1    Type 'MyClass+MyEnum' was not found.   

    Do I something wrong or is there some problem with VS designer?

    Wednesday, November 10, 2010 10:46 AM

All replies