meds
meds

Reputation: 22956

xaml parse exception when attempting to load xaml from codebehind

I have the following line of code defined in codebehind in silverlight:

Path path = XamlReader.Load( "<Path Data=\"F1 M 44.207,34.0669C 44.4841,33.7278 44.7612,33.3886 45.0383,33.0494\" />" ) as Path;

enter image description here

No idea why it's happening...

Upvotes: 3

Views: 510

Answers (1)

Adam Sills
Adam Sills

Reputation: 17062

As the exception states, you are missing the default namespace in your XAML document. The <Path> element needs an XML namespace.

Add the attribute xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" to your Path element.

http://msdn.microsoft.com/en-us/library/ms747086.aspx

And for reference, in case you're not familiar with them, as XAML is just XML, here is an introduction to XML namespaces: http://www.w3schools.com/xml/xml_namespaces.asp

Upvotes: 6

Related Questions