Enzomatric
Enzomatric

Reputation: 497

WPF Creating an instance of a class in xaml

I have a problem with creating the instance of a class in xaml file. I thought you can do it like this:

<src:MyDataClass x:Key="data"/>

in the resource part of the user control and then use it in the xaml file (for example bind to it).

But even tough the class I created is located in the same namespace it says that:

"The type was not found. Verfiy that all assemblies were built, etc".

How to get it right? is there another method?

Thanks for suggestions.

Upvotes: 1

Views: 5065

Answers (1)

DHN
DHN

Reputation: 4865

Well obviously you have to add the right namespace to your xaml. The namespace which contains the class you want instantiate. After reading this, you should be able to solve your problem.

Upvotes: 1

Related Questions