如何获取此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工作正常:当我将鼠标悬停在按钮上时,弹出的文本框会打招呼。
答案 0 :(得分:0)
您的InitBlah
方法的签名应与适当的evet相匹配。
试试这个:
public void InitBlah(object sender, MouseEventArgs e)
{
var x = 1;
}