开发者

How to control prefixes of namespaces in XML document generated by XmlWriter - generated XAML with x:Type markup extension

I am trying to generate XAML from XElements.

<Style xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
  <Style.BasedOn>
    <StaticResource> 
      <StaticResource.ResourceKey>
        <Type xmlns="http://schemas.microsoft.com/winfx/2006/xaml">
          <Type.TypeName>p:Window</Type.TypeName> 
        </Type>
      </StaticResource.ResourceKey>
    </StaticResource>
  </Style.BasedOn>
  ...
</Style>

However, I have problem with x:Type markup extension. It is unable to resolve the prefix p:, because I do not know how to force output XAML to map prefix p to namespace http://schemas.microsoft.com/w开发者_如何学Cinfx/2006/xaml/presentation.

Is there a way to control how prefixes of XML namespaces will be generated? Or is it possible to force x:Type markup extension to take XML namespace name instead of prefix?


I've found that:

new XAttribute(XNamespace.Xmlns + "p", "http://schemas.microsoft.com/winfx/2006/xaml/presentation"); 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜