2012-03-13 7 views
2

私は、イベントのソースがタッチであるときにWPFがマウスイベントを宣伝するのを防ぐ方法を教えてください。Touchイベントの横にマウスイベントが昇格されるのはなぜですか?

私はここでe.Handled = true;

をしましたが、私は、マウスイベントがトリガ得続ける、JoshB hereの記事を読んだがJoshBはこう言われる、無操作で

タッチイベントフロー。 WPFだから

同等マウスにイベントを促進するように、タッチイベントは、未処理のされている、私は取り扱わとしてイベントをマークするために私のコードで試してみましたが、私はInkSurface

ある _touchSurfaceに触れたら、WPFはまだマウスイベントを促進します

は、ここに私のコードです。(私はマイクロソフトのサーフェスSDKを使用していない)

_touchSurface.IsManipulationEnabled = true; 
_touchSurface.TouchDown += new EventHandler<TouchEventArgs>(touchDown); 
_touchSurface.TouchMove += new EventHandler<TouchEventArgs>(touchMove); 
_touchSurface.TouchEnter += new EventHandler<TouchEventArgs>(touchEnter); 
_touchSurface.TouchLeave += new EventHandler<TouchEventArgs>(touchLeave); 

_touchSurface.ManipulationDelta += new EventHandler<ManipulationDeltaEventArgs>(ManipulationDelta); 
_touchSurface.ManipulationStarting += new EventHandler<ManipulationStartingEventArgs>(ManipulationStarting); 
_touchSurface.ManipulationCompleted += new EventHandler<ManipulationCompletedEventArgs>(ManipulationCompleted); 


void touchDown(object sender, TouchEventArgs e) 
{ 
e.Handled = true; 
} 
void touchMove(object sender, TouchEventArgs e) 
{ 
e.Handled = true; 
} 
void touchLeave(object sender, TouchEventArgs e) 
{ 
e.Handled = true; 
} 


void ManipulationDelta(object sender, ManipulationDeltaEventArgs e) 
{ 
    e.Handled = true; 
} 

void ManipulationStarting(object sender, ManipulationStartingEventArgs e) 
{ 
    e.Handled = true; 
} 
void ManipulationCompleted(object sender, ManipulationCompletedEventArgs e) 
{ 
    e.Handled = true; 
} 
+0

PreviewTouchDown -Upなどを試しましたか? – Silvermind

+0

はい、私はPreviewTouchDownとPreviewTouchMoveを試しましたが、WPFはマウスイベントのプロモーションを続けています。 – simo

+0

解決策を見つけましたか? (もしそうなら - >投稿する?) – ZSH

答えて

0

サミル:私はあまりにもちょうどこれと同じ問題がありました。そのUIElementベースのコンポーネントからクラスを派生させ、マウスとタッチイベント(イベントハンドラを設定するのではなく)をオーバーライドしましたか?

https://github.com/100kph/TouchMousePromotionは、たとえばあなたがいないは、マウスイベントが昇進したいですなら、あなたはTouchDownを処理する必要はありません

1

スタブとe.Handled = trueを設定しています。その後、操作コードが入り、マウスイベントが発生しません。

関連する問題