Moj*_*ter 4 .net c# silverlight wpf xaml
如何在xaml中引用类的静态属性?换句话说,我想做这样的事情:
Class BaseThingy {
public static readonly Style BaseStyle;
...
}
Run Code Online (Sandbox Code Playgroud)
<ResoureDictionary ...>
<Style BasedOn="BaseThingy.Style" TargetType="BaseThingy" />
</ResourceDictionary>
Run Code Online (Sandbox Code Playgroud)
在BasedOn中执行此操作的语法是什么?我认为它会StaticResource在某种程度上涉及使用,但我还没有让它为我工作.
aku*_*aku 11
使用x:静态标记扩展
<ResoureDictionary ...
xmlns:local="clr-namespace:Namespace.Where.Your.BaseThingy.Class.Is.Defined"
>
<Style BasedOn="{x:Static local:BaseThingy.BaseStyle}" TargetType="BaseThingy" />
</ResourceDictionary>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6955 次 |
| 最近记录: |