原文:使用带ParserContext参数的Xaml.Load方法

如果一段XAML中存在一个标记需要从外部命名空间中解析, 就需要用到ParserContext类,  具体用法如下:

Normal
0

false
false
false

EN-US
ZH-CN
X-NONE

MicrosoftInternetExplorer4

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0in;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}

ParserContext

pc = new
ParserContext
();

     
pc.XmlnsDictionary.Add(""
, "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
);

      pc.XamlTypeMapper = new
XamlTypeMapper
(new
string
[0]);

     
pc.XamlTypeMapper.AddMappingProcessingInstruction(

        "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
,

        "ClassLibrary1"
,

        "ClassLibrary1"
);

      object
o = XamlReader
.Parse("<SharedResourceDictionary
Source=/"pack://application:,,,/KeyOfVictory;component/Dictionary1.xaml/"/>"
,
pc);

 

XmlnsDictionary属性中存储XML命名空间和命名空间前缀的对应关系, XamlTypeMapper类型中存储XML命名空间和CLR命名空间的对应关系, 并且还存储了定义CLR命名空间的程序集名称, 需要注意的是程序集名称就是程序集的partial name, 不需要有dll后缀。

使用带ParserContext参数的Xaml.Load方法的更多相关文章

  1. jQuery AJAX load() 方法

    jQuery load() 方法 jQuery load() 方法是简单但强大的 AJAX 方法. load() 方法从服务器加载数据,并把返回的数据放入被选元素中. 语法: $(selector). ...

  2. 2-jQuery - AJAX load() 方法【进阶篇】

    第一篇的AJAX load() 方法过于简单,补充一下,完整的. 格式 $(selector).load(URL,data,callback); 源码 <!DOCTYPE html> &l ...

  3. 使用jquery的load方法设计动态加载,并解决被加载页面JavaScript失效问题

    一.问题分析 对于后台系统,相比大家都有所印象,知道其中的布局结构,如图: 在这种布局中我们需要将header,sidebar,footer分开,而且对于中间部分的content内容需要动态变化,即根 ...

  4. jQuery – AJAX load() 方法

    jQuery load() 方法 jQuery load() 方法是简单但强大的 AJAX 方法. load() 方法从服务器加载数据,并把返回的数据放入被选元素中. 语法: $(selector). ...

  5. jQuery 学习05——AJAX:定义、load()方法、get()/post()方法

    AJAX = 异步 JavaScript 和 XML(Asynchronous JavaScript and XML). load() 方法:从服务器加载数据,并把返回的数据放入被选元素中. 语法:$ ...

  6. Sql Server 带参数的存储过程执行方法

    Sql Server 带参数的存储过程执行方法 Visual C# 动态操作 SQL Server 数据库实例教程(4):带参数的存储过程执行方法 上一篇文章介绍了带参数的SQL语句执行方法和不带参数 ...

  7. js方法用来获取路径传参上所带的参数

    //js方法用来获取路径传参上所带的参数 function GetQueryString(param) { var reg = new RegExp("(^|&)" + p ...

  8. 爬虫 Http请求,urllib2获取数据,第三方库requests获取数据,BeautifulSoup处理数据,使用Chrome浏览器开发者工具显示检查网页源代码,json模块的dumps,loads,dump,load方法介绍

    爬虫 Http请求,urllib2获取数据,第三方库requests获取数据,BeautifulSoup处理数据,使用Chrome浏览器开发者工具显示检查网页源代码,json模块的dumps,load ...

  9. tomcat启动(三)Catalina分析-load方法分析

    load()方法按从上到下顺序分析(主要分析本人所没学过的知识点,其它略过...). Digester类作用 使用sax技术对xml进行解析 未开始解析时Digester.push(this)这个用来 ...

随机推荐

  1. 手把手教你----MyEclipse中 配置 Tomcat

    电脑上配置Tomcatserver 安装Tomcat并配置环境变量 測试是否配置成功 MyEclipse中配置Tomcat 想要开发Java Web的程序.首先在MyEclipse中必须配置Tomca ...

  2. 【Codeforces Round #185 (Div. 2) D】Cats Transport

    [链接] 链接 [题意] 有n座山,m只猫. 每只猫都在其中的一些山上玩. 第i只猫在h[i]山上玩,且会在t[i]时刻出现在山脚下(然后就一直在那里等) 然后有p个人. 它们听从你的安排. 在某个时 ...

  3. [RxJS] Use takeUntil instead of manually unsubscribing from Observables

    Manually unsubscribing from subscriptions is safe, but tedious and error-prone. This lesson will tea ...

  4. [RxJS] Conclusion: when to use Subjects

    As a conclusion to this course about RxJS subjects, let's review when and why should you use them. F ...

  5. Hbase常见异常 分类: B7_HBASE 2015-02-02 16:16 412人阅读 评论(0) 收藏

    1. HBase is able to connect to ZooKeeper but the connection closes immediately hbase(main):001:0> ...

  6. php实现 称砝码(背包)

    php实现 称砝码(背包) 一.总结 一句话总结: 1.dp的实质是什么? 刷表啊,用空间换时间 把表画出来会做得更快 13 //动态规划就是一个表 14 //至于这个表的更新就是上面层的表更新下面层 ...

  7. 关于.c和.h 和定义变量的问题

    最初调试的时候是因为有个错误在wavplay.h文件中 于是我跳到了recorderl.h中:从图中看到引用了main.h 出现这个问题的具体原因还是不太清楚: 不过我任务是因为: wavplay.h ...

  8. markdown + vim

    https://www.jianshu.com/p/24aefcd4ca93https://github.com/isnowfy/python-vim-instant-markdownhttps:// ...

  9. IntelliJ IDEA设置鼠标悬浮提示

    测试代码; public interface MyInterface { /** * 我是接口方法的注释 * @param num1 我是接口方法入参的注释 * @return 我是接口方法返回值的注 ...

  10. 在windows下远程访问linux服务器

    在网络性能.安全性.可管理性上,Linux有着其他系统无法比拟的强大优势,而服务器对这些方面要求特别高,因此Linux常常被用来做服务器使用.而当我们需要维护linux服务器的时候,就需要远程访问li ...