WP8.1中的XamlReader错误

时间:2014-08-22 04:27:36

标签: c# xaml windows-runtime windows-phone-8.1

我从MSDN Website

复制此代码
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]

请帮我修理一下。感谢

1 个答案:

答案 0 :(得分:1)

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

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