如何去约在XAML中引用类的静态属性?换句话说,我想要做这样的事情:
How does one go about referencing a class's static properties in xaml? In other words, I want to do something like this:
Class BaseThingy {
public static readonly Style BaseStyle;
...
}
<ResoureDictionary ...>
<Style BasedOn="BaseThingy.Style" TargetType="BaseThingy" />
</ResourceDictionary>
什么是语法要做到这一点,在支持算法FMP?我以为这会涉及使用的StaticResource
在一定程度上,但我还没有得到它为我工作。
What is the syntax to do this in the BasedOn? I assumed it would involve using StaticResource
to some degree, but I haven't gotten it to work for me.
使用 X:静态标记扩展
<ResoureDictionary ...
xmlns:local="clr-namespace:Namespace.Where.Your.BaseThingy.Class.Is.Defined"
>
<Style BasedOn="{x:Static local:BaseThingy.BaseStyle}" TargetType="BaseThingy" />
</ResourceDictionary>