我的应用使用Silverlight 8.0 SDK,MSGestureHold
事件适用于Windows 8,但如果在8.1上测试相同,则不会触发事件。
答案 0 :(得分:0)
此代码适用于WPhone 8.1应用的webview:
var init = function(){
var myState = // context
var target = // DOM variable target
var msg = new MSGesture();
msg.target = target;
target.addEventListener("MSGestureHold", function (evt) { buttonTactileListener.apply(myState, [evt, msg]); }, false);
target.addEventListener("pointerdown", function (evt) { buttonTactileListener.apply(myState, [evt, msg]); }, false);
target.addEventListener("MSGestureEnd", function (evt) { buttonTactileListener.apply(myState, [evt, msg]); }, false);
}
var buttonTactileListener = function (evt, msgesture) {
var myState = this;
if (evt.type == "pointerdown") {
msgesture.addPointer(evt.pointerId);
return;
}
if (evt.type == "MSGestureHold") {
///do something
return;
}
if (evt.type == "MSGestureEnd") {
// renew instance of handler
msgesture = new MSGesture();
msgesture.target = evt.target;
return;
}
}