Automation.RemoveAutomationFocusChangedEventHandler Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Remove o manipulador de eventos com foco alterado especificado.
public:
static void RemoveAutomationFocusChangedEventHandler(System::Windows::Automation::AutomationFocusChangedEventHandler ^ eventHandler);
public static void RemoveAutomationFocusChangedEventHandler (System.Windows.Automation.AutomationFocusChangedEventHandler eventHandler);
static member RemoveAutomationFocusChangedEventHandler : System.Windows.Automation.AutomationFocusChangedEventHandler -> unit
Public Shared Sub RemoveAutomationFocusChangedEventHandler (eventHandler As AutomationFocusChangedEventHandler)
Parâmetros
- eventHandler
- AutomationFocusChangedEventHandler
Um método de manipulador que foi passado para AddAutomationFocusChangedEventHandler(AutomationFocusChangedEventHandler).
Comentários
O código de exemplo a seguir mostra um manipulador de eventos com alteração de foco sendo adicionado e removido.
AutomationFocusChangedEventHandler focusHandler = null;
/// <summary>
/// Create an event handler and register it.
/// </summary>
public void SubscribeToFocusChange()
{
focusHandler = new AutomationFocusChangedEventHandler(OnFocusChange);
Automation.AddAutomationFocusChangedEventHandler(focusHandler);
}
/// <summary>
/// Handle the event.
/// </summary>
/// <param name="src">Object that raised the event.</param>
/// <param name="e">Event arguments.</param>
private void OnFocusChange(object src, AutomationFocusChangedEventArgs e)
{
// TODO Add event handling code.
// The arguments tell you which elements have lost and received focus.
}
/// <summary>
/// Cancel subscription to the event.
/// </summary>
public void UnsubscribeFocusChange()
{
if (focusHandler != null)
{
Automation.RemoveAutomationFocusChangedEventHandler(focusHandler);
}
}
Private focusHandler As AutomationFocusChangedEventHandler = Nothing
''' <summary>
''' Create an event handler and register it.
''' </summary>
Public Sub SubscribeToFocusChange()
focusHandler = New AutomationFocusChangedEventHandler(AddressOf OnFocusChange)
Automation.AddAutomationFocusChangedEventHandler(focusHandler)
End Sub
''' <summary>
''' Handle the event.
''' </summary>
''' <param name="src">Object that raised the event.</param>
''' <param name="e">Event arguments.</param>
Private Sub OnFocusChange(ByVal src As Object, ByVal e As AutomationFocusChangedEventArgs)
End Sub
' TODO Add event handling code.
' The arguments tell you which elements have lost and received focus.
''' <summary>
''' Cancel subscription to the event.
''' </summary>
Public Sub UnsubscribeFocusChange()
If (focusHandler IsNot Nothing) Then
Automation.RemoveAutomationFocusChangedEventHandler(focusHandler)
End If
End Sub
Aplica-se a
Confira também
Colabore connosco no GitHub
A origem deste conteúdo pode ser encontrada no GitHub, onde também pode criar e rever problemas e pedidos Pull. Para mais informações, consulte o nosso guia do contribuidor.