Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to reference a class of enumerations in the xaml markup. I have successfully referenced this class by using "Add User Import" on the References section of my project. I can now access these enumerations from the VB side, but not from XAML.

XML
<Window x:Class="Window2"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:gcl="clr-namespace:GeomaniacClassLibrary.Enumerations;assembly=GeomaniacClassLibrary"


The intellisense does not allow me to access the .Enumerations class. The following code gives an error saying Error 7 The name "PointClass" does not exist in the namespace "clr-namespace:GeomaniacClassLibrary.Enumerations;assembly=GeomaniacClassLibrary".

XML
<Window.Resources>
       <ObjectDataProvider MethodName="GetValues"
                       ObjectType="{x:Type sys:Enum}"
                       x:Key="PointClasses">
           <ObjectDataProvider.MethodParameters>
               <x:Type TypeName="gcl:PointClass" />
           </ObjectDataProvider.MethodParameters>
       </ObjectDataProvider>
   </Window.Resources>


Any ideas ?
Posted
Comments
Pheonyx 7-Aug-13 4:45am    
Sounds strange, by try re-building the solution, sometimes I have found WPF does not fully reference the dll namespace in the XAML until it is rebuilt.

1 solution

I appear to have solved the problem myself.

I created an Enumerations namespace in GeomaniacClassLibrary and added my enumerations to it. It now appears in the xaml intellisense and works.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900