【问题标题】:Tap event using EventTrigger not triggered with windows phone 8使用 Windows Phone 8 未触发的使用 EventTrigger 的点击事件
【发布时间】:2013-06-30 14:09:05
【问题描述】:

知道为什么我的 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>

我在这件事上花了很多时间,但我就是不知道我做错了什么或者我错过了什么。

谢谢。

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多