我在这里过度简化了我的代码。毋庸置疑,绑定有效但触发却没有。
<Style TargetType="{x:Type c:SplineConnection}" BasedOn="{StaticResource {x:Type c:BezierSpline}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type c:SplineConnection}">
<Canvas>
<c:SplinePoint Point="{Binding Path=StartPoint, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Background="{Binding Path=StartBrush, RelativeSource={RelativeSource TemplatedParent}}" />
</Canvas>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="StartBrush" Value="White" />
<Setter Property="EndBrush" Value="White" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
触发器工作(我测试它做了手动连接),但它不会更改SplineConnection控件的StartBrush属性,从而触发SplinePoint的绑定。
如何让模板触发器设置器更改控件的(绑定)属性?