AutomationPropertyChangedEventArgs(AutomationProperty, Object, Object) Конструктор

Определение

Инициализирует новый экземпляр класса 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)

Параметры

property
AutomationProperty

Идентификатор измененного свойства.

oldValue
Object

Предыдущее значение свойства.

newValue
Object

Новое значение свойства.

Примеры

В следующем примере создается событие при изменении свойства.

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

Комментарии

oldValueможет быть null (Nothingв Visual Basic), если предыдущее значение недоступно.

Применяется к