番号 123.456 (InputScope="Number") のテキスト ボックスがあるとします。
フォーカスを取得してタップすると、456 が自動選択されます。
これをキャンセルするプロパティが表示されません。隠された方法はありますか?
番号 123.456 (InputScope="Number") のテキスト ボックスがあるとします。
フォーカスを取得してタップすると、456 が自動選択されます。
これをキャンセルするプロパティが表示されません。隠された方法はありますか?
SelectionChanged
イベントを処理することによって選択が行われるたびに、すべてを選択解除することができます。例えば
private void myTextbox_SelectionChanged(object sender, RoutedEventArgs e)
{
//get the position the user clicked
int start = myTextbox.SelectionStart;
//detach this event handler so it's not fired when we clear the selection
myTextbox.SelectionChanged -= myTextbox_SelectionChanged;
//clear the selection but keep the cursor in the place it would've been
myTextbox.Select(start, 0);
//reattach the handler
myTextbox.SelectionChanged += myTextbox_SelectionChanged;
}
これにより、テキストが選択されなくなります。ユーザーがテキストボックス内でタップした実際の位置を取得するには、Tap
イベントを処理し、渡されたパラメーターのGetPosition()
メソッドを使用できます。GestureEventArgs