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

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

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

Important Note:

A 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)的的更多相关文章

  1. Java向前引用容易出错的地方

    所谓向前引用,就是在定义类.接口.方法.变量之前使用它们,例如, class MyClass { void method() { System.out.println(myvar); } String ...

  2. java向前引用

    根据看书和看得文章,引出了一个关于"向前引用"的问题: public class InstanceInitTest { static { // { a = 6; System.ou ...

  3. python自定义函数可以向前引用不用声明

    #有些编程语言不够"聪明",向这类向前引用的方式会导致报错,但Python足够"醒目",这段代码是正确的! def next():     print('我在n ...

  4. How do I duplicate a resource reference in code behind in WPF?如何在WPF后台代码中中复制引用的资源?

    原文 https://stackoverflow.com/questions/28240528/how-do-i-duplicate-a-resource-reference-in-code-behi ...

  5. 向前引用 ? float VS long ? 这些知识你懂吗?

    thinking in java 读书笔记(感悟): 作者:淮左白衣 : 写于 2018年4月2日18:14:15 目录 基本数据类型 float 和 long 谁更大 System.out.prin ...

  6. Forward reference vs. forward declaration

    Q:Im a bit confused. What is the difference between forward declaration and forward reference? Forwa ...

  7. 错误代码: 1247 Reference 'startTime' not supported (forward reference in item list)

    1.错误描述 1 queries executed, 0 success, 1 errors, 0 warnings 查询:SELECT a.createUserId AS typeId, (SELE ...

  8. 方法引用(Method reference)和invokedynamic指令详细分析

    方法引用(Method reference)和invokedynamic指令详细分析 invokedynamic是jvm指令集里面最复杂的一条.本文将详细分析invokedynamic指令是如何实现方 ...

  9. Java中的函数式编程(四)方法引用method reference

    写在前面 我们已经知道,lambda表达式是一个匿名函数,可以用lambda表达式来实现一个函数式接口.   很自然的,我们会想到类的方法也是函数,本质上和lambda表达式是一样的,那是否也可以用类 ...

随机推荐

  1. SNMP 监控方式的配置

    由于某些设备并不能安装 Agent,或者不方便安装 Agent 等因素,将采用 SNMP 方式进行监控 1.Linux 配置 SNMP [root@crazy-acong ~]# yum -y ins ...

  2. [Tjoi2018]数学计算

    [Tjoi2018]数学计算 BZOJ luogu 线段树分治 是不是想问为什么不暴力做? 模数没说是质数,所以不一定有逆元. 然后就是要每次build一下把线段树权值init成1, 博猪不知道为什么 ...

  3. Ext部署在本地tomcat下运行例子

    我本地用的ext6+,从官网下载好Ext后解压到D盘,然后打开tomcat的server.xml,在Host标签内配置 <Context path="/ext-6.2.0" ...

  4. linux 8 -- 管道组合Shell命令进行系统管理

    二十. 通过管道组合Shell命令获取系统运行数据: 1.  输出当前系统中占用内存最多的5条命令:     #1) 通过ps命令列出当前主机正在运行的所有进程.     #2) 按照第五个字段基于数 ...

  5. python 的for else语句

    for中间不是break出来的,是正常循环完跳出循环的会执行else内的语句 while else语句也是如此 这个以前的常见语言没有,特此记录

  6. QT设置TextEdit颜色

    //设置textEdit颜色 QPalette palette= ui->receiveTextEdit->palette(); palette.setColor(QPalette::Ba ...

  7. python 局部local和全局global变量

    global和local变量 虽然简单,但是还是记录一下,主要是转载 转载自:http://blog.sina.com.cn/s/blog_436992740102ux8z.html   先看一段代码 ...

  8. 第2条:遵循PEP8风格指南

    <Python Enhancement Proposal #8>(8号Python增强提案)又叫PEP8,它是针对Python代码格式而编订的风格指南. 尽管可以在保证语法正确的前提下随意 ...

  9. Yii2 如何实现表单事件之 Ajax 提交

    前言 Yii2 现在使用 JS 都必须要注册代码了. 要实现 Ajax 提交,有两种方法.一是直接在 ActiveForm 调用 beforeSubmit 参数,但是个人认为这样没有很好的把 JS 和 ...

  10. 《程序员代码面试指南》第三章 二叉树问题 遍历二叉树的神级方法 morris

    题目 遍历二叉树的神级方法 morris java代码 package com.lizhouwei.chapter3; /** * @Description:遍历二叉树的神级方法 morris * @ ...