Compartir vía


AutomationPropertyChangedEventArgs(AutomationProperty, Object, Object) Constructor

Definición

Inicializa una nueva instancia de la clase AutomationPropertyChangedEventArgs.

public:
 AutomationPropertyChangedEventArgs(System::Windows::Automation::AutomationProperty ^ property, System::Object ^ oldValue, System::Object ^ newValue);
public AutomationPropertyChangedEventArgs (System.Windows.Automation.AutomationProperty property, object oldValue, object newValue);
new System.Windows.Automation.AutomationPropertyChangedEventArgs : System.Windows.Automation.AutomationProperty * obj * obj -> System.Windows.Automation.AutomationPropertyChangedEventArgs
Public Sub New (property As AutomationProperty, oldValue As Object, newValue As Object)

Parámetros

property
AutomationProperty

Identificador de la propiedad que ha cambiado.

oldValue
Object

Valor anterior de la propiedad.

newValue
Object

Nuevo valor de la propiedad.

Ejemplos

En el ejemplo siguiente se crea y se genera un evento cuando una propiedad ha cambiado.

/// <summary>
/// Raises an event when the IsEnabled property on a control is changed.
/// </summary>
/// <param name="provider">The UI Automation provider for the control.</param>
/// <param name="newValue">The current enabled state.</param>
private void RaiseEnabledEvent(IRawElementProviderSimple provider, bool newValue)
{
    if (AutomationInteropProvider.ClientsAreListening)
    {
        AutomationPropertyChangedEventArgs args =
            new AutomationPropertyChangedEventArgs(AutomationElement.IsEnabledProperty,
                !newValue, newValue);
        AutomationInteropProvider.RaiseAutomationPropertyChangedEvent(provider, args);
    }
}
''' <summary>
''' Raises an event when the IsEnabled property on a control is changed.
''' </summary>
''' <param name="provider">The UI Automation provider for the control.</param>
''' <param name="newValue">The current enabled state.</param>
Private Sub RaiseEnabledEvent(ByVal provider As IRawElementProviderSimple, ByVal newValue As Boolean) 
    If AutomationInteropProvider.ClientsAreListening Then
        Dim args As New AutomationPropertyChangedEventArgs(AutomationElement.IsEnabledProperty, Not newValue, newValue)
        AutomationInteropProvider.RaiseAutomationPropertyChangedEvent(provider, args)
    End If

End Sub

Comentarios

oldValue puede ser null (Nothing en Visual Basic) si el valor anterior no está disponible fácilmente.

Se aplica a