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

不允许向前引用(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.

 

原文链接: https://www.cnblogs.com/TaiYangXiManYouZhe/p/5126839.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

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

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/227322

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月13日 下午1:33
下一篇 2023年2月13日 下午1:33

相关推荐