Stylus.StylusLeave Evento anexado

Definição

Ocorre quando o cursor da caneta sai dos limites de um elemento.

see AddStylusLeaveHandler, and RemoveStylusLeaveHandler
see AddStylusLeaveHandler, and RemoveStylusLeaveHandler
see AddStylusLeaveHandler, and RemoveStylusLeaveHandler

Exemplos

O exemplo a seguir demonstra como alterar a cor de um Button quando o cursor de caneta entra e deixa seus limites. Este exemplo pressupõe que há um Button chamado button1 e que os StylusEnter eventos e StylusLeave estão conectados a manipuladores de eventos.

Brush originalColor;

void button1_StylusLeave(object sender, StylusEventArgs e)
{
    button1.Background = originalColor;
}

void button1_StylusEnter(object sender, StylusEventArgs e)
{
    originalColor = button1.Background; 
    button1.Background = Brushes.Gray;
}
Private originalColor As Brush

Private Sub button1_StylusLeave(ByVal sender As Object, ByVal e As StylusEventArgs) _
    Handles button1.StylusLeave

    button1.Background = originalColor

End Sub

Private Sub button1_StylusEnter(ByVal sender As Object, ByVal e As StylusEventArgs) _
    Handles button1.StylusEnter

    originalColor = button1.Background
    button1.Background = Brushes.Gray

End Sub

Comentários

Esse é um evento anexado. O WPF implementa eventos anexados como eventos roteados. Um evento anexado é, fundamentalmente, um conceito de linguagem XAML usado para referenciar eventos que são tratados em objetos que não definem eventos. O WPF expande ainda mais os recursos de um evento anexado, permitindo que ele percorra uma rota. Os eventos anexados não têm uma sintaxe de tratamento direto no código; para anexar manipuladores para um evento roteado no código, use um método Add*Handler designado. Para obter detalhes, consulte Visão geral de eventos anexados.

Informações de evento encaminhado

Campo Identificador StylusLeaveEvent
Estratégia de roteamento Direto
Delegar StylusEventHandler

Aplica-se a

Confira também