AutomationPropertyChangedEventArgs(AutomationProperty, Object, Object) 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 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
在Visual Basic) 中 (Nothing
。