开发者

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.7开发者_开发知识库278 44.7612,33.3886 45.0383,33.0494\" />" ) as Path;

xaml parse exception when attempting to load xaml from codebehind

No idea why it's happening...


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜