Stylus.LostStylusCapture Присоединенное событие
Определение
Происходит, когда элемент освобождает события пера.Occurs when an element releases stylus events.
see AddLostStylusCaptureHandler, and RemoveLostStylusCaptureHandler
see AddLostStylusCaptureHandler, and RemoveLostStylusCaptureHandler
see AddLostStylusCaptureHandler, and RemoveLostStylusCaptureHandler
Примеры
В следующем примере показано, как изменить цвет фона объекта, TextBox TextBox когда захватывается и выпускают события пера.The following example demonstrates how to change the background color of a TextBox when the TextBox captures and releases stylus events. В этом примере предполагается, что имеется текстовое textBox1
поле с именем, GotStylusCapture а LostStylusCapture события и подключены к обработчикам событий в примере.This example assumes that there is a textbox called textBox1
, and that the GotStylusCapture and LostStylusCapture events are connected to the event handlers in the example.
void textbox1_LostStylusCapture(object sender, StylusEventArgs e)
{
textbox1.Background = Brushes.White;
}
void textbox1_GotStylusCapture(object sender, StylusEventArgs e)
{
textbox1.Background = Brushes.Red;
}
Private Sub textbox1_LostStylusCapture(ByVal sender As Object, ByVal e As StylusEventArgs) _
Handles textbox1.LostStylusCapture
textbox1.Background = Brushes.White
End Sub
Private Sub textbox1_GotStylusCapture(ByVal sender As Object, ByVal e As StylusEventArgs) _
Handles textbox1.GotStylusCapture
textbox1.Background = Brushes.Red
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 *.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 | LostStylusCaptureEvent |
Стратегия маршрутизацииRouting strategy | Восходящей маршрутизацииBubbling |
делегатDelegate | StylusEventHandler |