WP8.1中的XamlReader错误

本文关键字:错误 XamlReader 中的 WP8 | 更新日期: 2023-09-27 18:19:06

我从MSDN网站复制了这段代码

string xaml = "<Ellipse Name='"EllipseAdded'" Width='"300.5'" Height='"200'" Fill='"Red'"       '"http://schemas.microsoft.com/winfx/2006/xaml/presentation'"/>";
object ellipse = XamlReader.Load(xaml);

但是我抛出一个错误

The text associated with this error code could not be found. illegal 
qualified name character [Line: 1 Position: 68]

请帮我修理一下。由于

WP8.1中的XamlReader错误

请尝试以下XAML,似乎缺少xmlns。

string xaml = "<Ellipse Name='"EllipseAdded'" Width='"300.5'" Height='"200'" Fill='"Red'"       xmlns='"http://schemas.microsoft.com/winfx/2006/xaml/presentation'"/>";