不允许向前引用(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 are searched. For best results, adjust the composition of your resource dictionaries such that forward references can be avoided.