AutomationInteropProvider.RaiseAutomationPropertyChangedEvent 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
当 UI 自动化属性更改时引发事件。
public:
static void RaiseAutomationPropertyChangedEvent(System::Windows::Automation::Provider::IRawElementProviderSimple ^ element, System::Windows::Automation::AutomationPropertyChangedEventArgs ^ e);
public static void RaiseAutomationPropertyChangedEvent (System.Windows.Automation.Provider.IRawElementProviderSimple element, System.Windows.Automation.AutomationPropertyChangedEventArgs e);
static member RaiseAutomationPropertyChangedEvent : System.Windows.Automation.Provider.IRawElementProviderSimple * System.Windows.Automation.AutomationPropertyChangedEventArgs -> unit
Public Shared Sub RaiseAutomationPropertyChangedEvent (element As IRawElementProviderSimple, e As AutomationPropertyChangedEventArgs)
参数
- element
- IRawElementProviderSimple
与该事件关联的元素。
有关事件的信息。
示例
/// <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