แก้ไข

แชร์ผ่าน


IRawElementProviderSimple.HostRawElementProvider Property

Definition

Gets a base provider for this element.

public:
 property System::Windows::Automation::Provider::IRawElementProviderSimple ^ HostRawElementProvider { System::Windows::Automation::Provider::IRawElementProviderSimple ^ get(); };
public System.Windows.Automation.Provider.IRawElementProviderSimple HostRawElementProvider { get; }
member this.HostRawElementProvider : System.Windows.Automation.Provider.IRawElementProviderSimple
Public ReadOnly Property HostRawElementProvider As IRawElementProviderSimple

Property Value

The base provider, or null.

Examples

The following example code shows an implementation of HostRawElementProvider for a fragment root that is hosted in a Windows form.

IRawElementProviderSimple IRawElementProviderSimple.HostRawElementProvider  
{
    get 
    {
        // myHWND is the handle of the window that contains this control.
        return AutomationInteropProvider.HostProviderFromHandle(myHWND);
    }
}
ReadOnly Property HostRawElementProvider() As IRawElementProviderSimple _
    Implements IRawElementProviderSimple.HostRawElementProvider

    Get
        ' myHWND is the handle of the window that contains this control.
        Return AutomationInteropProvider.HostProviderFromHandle(myHWND)
    End Get
End Property

Remarks

This property is the UI Automation provider for the window of a custom control. UI Automation uses this provider in combination with your provider implementation for a control hosted in a window. For example, the run-time identifier of the element is obtained from the host provider.

A host provider must be returned in any of the following cases:

  • This element is the root of a fragment.

  • The element is a simple element such as a pushbutton.

  • The provider is a repositioning placeholder.

In other cases, the property should return null.

Applies to

See also