我正在使用Windows应用商店应用(Windows 8.1),我正在使用这样的搜索框:
<SearchBox x:Name="SearchText" QueryText="{Binding QueryText, Mode=TwoWay}">
<i:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="QuerySubmitted">
<core:InvokeCommandAction Command="{Binding SearchCommand}" />
</core:EventTriggerBehavior>
</i:Interaction.Behaviors>
</SearchBox>
这在Windows 8.1中运行良好,但我只测试了Windows 10的预览版本,发现SearchCommand没有触发。当我在后面的代码中添加一个eventhandler时,QuerySubmitted事件会正确触发,因此看起来绑定不起作用。有没有人遇到过同样的问题?
答案 0 :(得分:0)
试试这个:
<SearchBox>
<interactivity:Interaction.Triggers>
<interactivity:EventTrigger EventName="QueryChanged">
<interactivity:InvokeCommandAction Command="{Binding TxtSearchCommand}"></interactivity:InvokeCommandAction>
</interactivity:EventTrigger>
</interactivity:Interaction.Triggers>
</SearchBox>