0

我有一个 xml 文件并在 silverlight 中使用。

doc.Descendants(xamlparent).FirstOrDefault().Add(new XAttribute("x:Class","WorkflowConsoleApplication1.modify"));

但是在这个“:”十六进制导致错误。我怎样才能在属性名称中添加这个十六进制。这可能吗?

4

1 回答 1

1

您必须查看映射到x命名空间前缀的命名空间的 URI。查看 XML 文档的顶部,它将包含类似xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml".

XAttribute然后,您使用上面的完整 XML 命名空间 URI实例化,如下所示:

new XAttribute(XName.Get("Class", "http://schemas.microsoft.com/winfx/2006/xaml"), "WorkflowConsoleApplication1.modify")

进一步阅读:

于 2013-01-24T10:17:19.397 回答