title: Reference nested enum type from XAML
body: <p>I can't seem to reference a public nested enum type from XAML.  I have a class</p>
  
  <pre><code>namespace MyNamespace
  {
    public class MyClass
    {
      public enum MyEnum
      {
         A,
         B,
      }
    }
  }
  </code></pre>
  
  <p>And I try to reference <code>MyEnum</code> in Xaml like this:</p>
  
  <pre><code>xmlns:MyNamespace="clr-namespace:MyNamespace;assembly=MyApp"
  ....
  
  {x:Type MyNamespace:MyClass:MyEnum}    // DOESN'T WORK
  </code></pre>
  
  <p>but VS complains it can't find public type <code>MyEnum</code>.  I also tried using the <code>+</code> syntax based on one of the answers to <a href="https://stackoverflow.com/questions/5676649/unable-to-find-enum-type-for-static-reference-in-wpf">this post</a>...</p>
  
  <pre><code>{x:Type MyNamespace:MyClass+MyEnum}    // DOESN'T WORK
  </code></pre>
  
  <p>but that doesn't work either.  </p>
  
  <p>Note that <code>x:Static</code> <i>does</i> work with the <code>+</code> syntax:</p>
  
  <pre><code>{x:Static MyNamespace:MyClass+MyEnum.A}  // WORKS
  </code></pre>
  
  <p>And if I move <code>MyEnum</code> out of <code>MyClass</code> I can reference it too.  But not if it's nested... </p>
  
  <p>So what am I missing?  How do I reference a nested enum from XAML using <code>x:Type</code>?  (And note, I'm not trying to instantiate anything, just reference the type).</p>
  
  <p><b>UPDATE</b></p>
  
  <p>It looks like this is just a bug with the VS 2010 designer.  The designer complains that <code>Type MyNamespace:MyClass+MyEnum was not found</code>.  But the application appears to run and properly access the nested type.  I tried this with a nested class too, and it works at run time.  </p>
  
  <p>Possible open bug: <a href="http://social.msdn.microsoft.com/forums/en-US/wpf/thread/12f3e120-e217-4eee-ab49-490b70031806/" rel="nofollow noreferrer">http://social.msdn.microsoft.com/forums/en-US/wpf/thread/12f3e120-e217-4eee-ab49-490b70031806/</a></p>
  
  <p>Related thread: <a href="https://stackoverflow.com/questions/2278925/wpf-design-time-error-while-writing-nested-type-in-xaml">Design time error while writing Nested type in xaml</a></p>