[WP8] [SL] [XAML]如何单独处理ListBox中的图像的Tap事件而不是SelectedChanged事件 [英] [WP8][SL][XAML]How to handle Tap event of An Image within a ListBox separately Instead of SelectedChanged Event

查看:71
本文介绍了[WP8] [SL] [XAML]如何单独处理ListBox中的图像的Tap事件而不是SelectedChanged事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ListBox,其中会有社交,消息,新闻等不同列表项的通知

i Have a ListBox Where There Will Notifications of Different List Items Like Social,messaging,News

当我点击通知图标时,它首先激活选择更改事件然后点击

When I Tap on Notification Icon it is Firing Selection Changed Event First And Then Firing

private void Notification_Tap(object sender,System.Windows.Input.GestureEventArgs e)

  {

private void Notification_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {

//

}

所以我成功处理了这个

bool TappedEnabled = false; private void Notification_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {


}

private void MyListBox_SelectionChanged(object sender,SelectionChangedEventArgs e)
{
if(TappedEnabled == false)

} private void MyListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if(TappedEnabled == false)

{
//做东西;

{ // Do stuff;

}
}

当你点击列表时它正在导航到选择更改事件中的页面时工作正常,或者当你点击图像时它正在浏览相应的页面,但是在从通知页面返回后它再次自动触发选择更改事件和再次
导航到选择更改事件页面。

it is working fine when u tap on list it is navigating to page in Selection Changed Event or when u tap on image it is navigating respective Page,But After Coming Back From Notifications Page it is again Automatically Firing Selection Changed Event And Again navigation to page in Selection Changed Event.

我不要像这样导航,它应该停在那里直到用户再次触发如何解决这个。谢谢

i Dont To Navigate like this ,it should Stop There until user Again Fires How To Solve This.Thanks

 

推荐答案

您是在构造函数中的某个位置更改列表框的selectedIndex,还是在加载页面时调用的事件中更改导入到导航时调用selectionChanged事件处理程序的事件这个页面。
Are you changing the selectedIndex of the listbox somewhere inside the constructor or in the events which gets called when a page is loaded which further leads to calling of selectionChanged event handler when you are navigating to this page.


这篇关于[WP8] [SL] [XAML]如何单独处理ListBox中的图像的Tap事件而不是SelectedChanged事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆