AutomationInteropProvider.RaiseAutomationPropertyChangedEvent 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當消費者介面自動化屬性變更時引發事件。
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