2

I'm trying to create a key for a class to use in XAML, but Visual Studio 11 says that no such class exists.

Steps:

I created a class inside my program namespace:

namespace Test {
    public class PointCollectionConverter : System.Windows.Data.IValueConverter....

I added a local namespace reference in MainWindow.xaml

xmlns:local="clr-namespace:GeometryTest"

I try to add the class as a resource:

<Window.Resources>
      <local:PointCollectionConverter x:Key="pointCollectionConverter"/>
</Window.Resources>

Fixed after recompilation.

James McNellis
  • 348,265
  • 75
  • 913
  • 977
stan
  • 4,885
  • 5
  • 49
  • 72
  • possible duplicate of [WPF - How to properly reference a class from XAML](http://stackoverflow.com/questions/2523908/wpf-how-to-properly-reference-a-class-from-xaml) – stan Apr 22 '12 at 03:11

1 Answers1

3

The namespace is Test and you use GeometryTest? Something's not right here.

How about:

xmlns:local="clr-namespace:Test"
H.B.
  • 166,899
  • 29
  • 327
  • 400
  • I changed the namespace for easier reading here. Turned out the I just needed to recompile it. But your answer was correct anyway :P – stan Apr 22 '12 at 02:58
  • 1
    @StanislavPalatnik: People seem to trust their IDEs too much; [a recent example](http://stackoverflow.com/questions/10250925). – H.B. Apr 22 '12 at 03:48