I am little confuse how to handle gesture tap event? When i tap my phone screen at that time gesture tap event fire two time automatically.But i want just one time
my code is
var g1 = GestureService.GetGestureListener(TransactionList);
g1.Tap += new EventHandler<Microsoft.Phone.Controls.GestureEventArgs>(g1_Tap);
g1.Hold += new EventHandler<Microsoft.Phone.Controls.GestureEventArgs>(g1_Hold);
void g1_Hold(object sender, Microsoft.Phone.Controls.GestureEventArgs e)
{
throw new NotImplementedException();
}
void g1_Tap(object sender, Microsoft.Phone.Controls.GestureEventArgs e)
{
ListBox hi = (ListBox)sender;
ClsGetNewCampaign cg = (ClsGetNewCampaign)hi.SelectedItem;
ClsGetNewCampaign.setlst(cg.cmpLoutAry);
//int campaignId = Convert.ToInt32(cg.CampaignID);
string campaignID = cg.CampaignID;
string campaignName = cg.CampainNAME;
string campaignImage = cg.CampainIMGPATH;
string layoutTitle = cg.LayoutTitle;
string layoutId = cg.LayoutID;
//_ClsDatabase.Add_Data(campaignId, campaignName, campaignImage, layoutTitle, layoutId);
string param = tbNew1.Text;
NavigationService.Navigate(new Uri(string.Format("/VodafoneARview/Advertisement.xaml?parameter0={0},parameter1={1},parameter2={2},parameter3={3},parameter4={4},parameter5={5}", param,campaignID,campaignName,campaignImage,layoutTitle,layoutId), UriKind.RelativeOrAbsolute));
}
As I mentioned in the comment on your answer, make sure that you haven't accidentally added the event handler twice:
g1.Tap += new EventHandler<Microsoft.Phone.Controls.GestureEventArgs>(g1_Tap);
That would explain why the event is firing twice :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.