Stylus.StylusButtonUp 添付イベント
定義
ユーザーがスタイラス上のボタンのいずれかを放したときに発生します。Occurs when the user releases one of the buttons on the stylus.
see AddStylusButtonUpHandler, and RemoveStylusButtonUpHandler
see AddStylusButtonUpHandler, and RemoveStylusButtonUpHandler
see AddStylusButtonUpHandler, and RemoveStylusButtonUpHandler
例
次の例は、ユーザーがスタイラスで胴体ボタンを放すと、選択したテキストをコピーする方法を示しています。The following example demonstrates how to copy the selected text when the user releases the barrel button on a stylus. この例では、がTextBox呼び出さtextBox1
れ、 StylusButtonUpイベントがイベントハンドラーに接続されていることを前提としています。This example assumes that there is a TextBox called textBox1
, and that the StylusButtonUp event is connected to the event handlers.
void textbox1_StylusButtonUp(object sender, StylusButtonEventArgs e)
{
if (e.StylusButton.Guid != StylusPointProperties.BarrelButton.Id)
{
return;
}
if (textbox1.SelectedText == "")
{
return;
}
Clipboard.SetDataObject(textbox1.SelectedText);
}
Private Sub textbox1_StylusButtonUp(ByVal sender As Object, ByVal e As StylusButtonEventArgs) _
Handles textbox1.StylusButtonUp
If e.StylusButton.Guid <> StylusPointProperties.BarrelButton.Id Then
Return
End If
If textbox1.SelectedText = "" Then
Return
End If
Clipboard.SetDataObject(textbox1.SelectedText)
End Sub
注釈
これは添付イベントです。This is an attached event. WPFWPF添付イベントをルーティングイベントとして実装します。implements attached events as routed events. 添付イベントとは、基本的にXAMLXAMLは、イベントを定義するのではなく、オブジェクトで処理されるイベントを参照するために使用される言語の概念です。An attached event is, fundamentally, a XAMLXAML language concept used to reference events that are handled on objects that do not, themselves, define events. WPFWPF添付イベントの機能をさらに拡張し、ルートを走査できるようにします。further expands an attached event's capabilities, allowing it to traverse a route. アタッチされたイベントには、コードで直接処理構文がありません。コードでルーティングイベントのハンドラーをアタッチするには、指定された Add * Handler メソッドを使用します。Attached events do not have a direct handling syntax in code; to attach handlers for a routed event in code, use a designated Add*Handler method. 詳細については、「添付イベントの概要」を参照してください。For details, see Attached Events Overview.
ルーティングされたイベント情報Routed Event Information
識別子フィールドIdentifier field | StylusButtonUpEvent |
ルーティング方法Routing strategy | バブリングBubbling |
DelegateDelegate | StylusButtonEventHandler |