Share via


AutomationPropertyChangedEventArgs(AutomationProperty, Object, Object) Konstruktor

Definition

Initialisiert eine neue Instanz der AutomationPropertyChangedEventArgs-Klasse.

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)

Parameter

property
AutomationProperty

Der Bezeichner der geänderten Eigenschaft.

oldValue
Object

Der vorherige Wert der Eigenschaft.

newValue
Object

Der neue Wert der Eigenschaft.

Beispiele

Im folgenden Beispiel wird ein Ereignis erstellt und ausgelöst, wenn sich eine Eigenschaft geändert hat.

/// <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

Hinweise

oldValuekann (Nothing in Visual Basic) sein null , wenn der vorherige Wert nicht ohne weiteres verfügbar ist.

Gilt für: