我在我的WPF应用程序中使用了
我的代码如下:
<setter>
,我需要使用TemplateBinding来评估该Setter Property的值,以在编译时进行计算,但我无法使用TemplateBinding,因为它会引发错误。我的代码如下:
<ControlTemplate TargetType="{x:Type srcview:ButtonView}">
<Button>
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{TemplateBinding Color}"></Setter>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</ControlTemplate>
我该如何在样式设置器中使用TemplateBinding
,或者是否有其他方法可以在编译时计算值?