码迷,mamicode.com
首页 > Windows程序 > 详细

wpf staticresource 是不允许向前引用(forward reference)的

时间:2016-01-13 12:45:28      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:

不允许向前引用(forward reference)在C/C++中中很常见,即在语法上,未定义变量、类之前,不能使用。

没想到wpf中的wpf staticresource也遵循这种规则。资源字典中,进行引用时,要主要了。

详见MSDN:https://msdn.microsoft.com/en-gb/library/cc189045(v=vs.95).aspx

 Important Note:

StaticResource must not attempt to make a forward reference to a resource that is defined lexically further within the XAML file. Attempting to do so is not supported, and even if such a reference does not fail, attempting the forward reference incurs a load-time performance penalty when the internal hash tables representing a ResourceDictionary are searched. For best results, adjust the composition of your resource dictionaries such that forward references can be avoided.

 

wpf staticresource 是不允许向前引用(forward reference)的

标签:

原文地址:http://www.cnblogs.com/TaiYangXiManYouZhe/p/5126839.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!