问题描述
<Button Height="50" BorderBrush="IndianRed" Margin="5,0"
x:Name="aBtn">
<Button.Resources>
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="IndianRed"/>
</Button.Resources>
<StackPanel Orientation="Vertical">
<TextBlock Text="Heating" />
</StackPanel>
<iActivity:Interaction.Behaviors>
<iAction:ChangePropertyAction PropertyName="Background" Value="IndianRed" Targetobject="aBtn" />
</iActivity:Interaction.Behaviors>
这不起作用。 (我使用的是 WinUI3 预览版 4)
解决方法
TargetObject="{Binding ElementName=aBtn}"
是必需的。