使用不使用Windows Phone 8触发的EventTrigger点击事件

时间:2013-06-30 14:09:05

标签: windows-phone-7 mvvm windows-phone-8 expression-blend eventtrigger

我知道为什么我的EventTrigger没有使用以下代码触发我的项目,这是listboxitem模板的一部分:

<TextBlock Text="{Binding FieldLabel}" Grid.Column="0" Margin="5,0,0,0" Foreground="Black">
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Tap">
           <i:InvokeCommandAction x:Name="FieldLabelTap" Command="{Binding DisplayInfoCommand, Mode=OneWay}" CommandParameter="{Binding}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
</TextBlock>

我花了很多时间在这上面,但我无法弄清楚我做错了什么或我错过了什么。

感谢。

1 个答案:

答案 0 :(得分:1)

问题解决了!我已经在错误的ViewModel(即ListBoxViewModel)中定义了ICommand for DisplayInfoCommand,它应该在我的ListBoxItemViewModel中定义,其中实际定义了FieldLabel。