如何获得这个 CallMethodAction 方法 InitBlah?目前它不火。我怀疑它的签名是错误的:
<Grid x:Name="LayoutRoot">
<Button x:Name="btnEnter" Content="Enter" HorizontalAlignment="Left" Height="48" Margin="96,88,0,0" VerticalAlignment="Top" Width="144">
<interactivity:Interaction.Triggers>
<interactivity:EventTrigger EventName="MouseEnter" SourceName="btnEnter">
<interactions:ChangePropertyAction PropertyName="Visibility" Value="Visible" TargetName="TextBoxTest" />
<interactions:CallMethodAction MethodName="InitBlah" TargetObject="{Binding}"/>
</interactivity:EventTrigger>
<interactivity:EventTrigger EventName="MouseLeave" SourceName="btnEnter">
<interactions:ChangePropertyAction PropertyName="Visibility" Value="Collapsed" TargetName="TextBoxTest" />
</interactivity:EventTrigger>
</interactivity:Interaction.Triggers>
</Button>
<Grid>
<TextBlock Name="TextBoxTest" Width="100" Height="100" Visibility="Collapsed">Hello</TextBlock>
后面的代码:
public void InitBlah(object sender, RoutedEventArgs e)
{
var x = 1;
}
ChangePropertyAction 工作正常:当我将鼠标悬停在按钮上时,会弹出文本框打招呼。