IRawElementProviderSimple.HostRawElementProvider 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取此元素的基本提供程序。
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
属性值
基本提供程序,或 null。
示例
以下示例代码演示托管在 Windows 窗体中的片段根的 HostRawElementProvider 实现。
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
注解
此属性是自定义控件窗口的UI 自动化提供程序。 UI 自动化将此提供程序与在窗口中托管的控件的提供程序实现结合使用。 例如,从主机提供程序获取元素的运行时标识符。
必须在以下任一情况下返回主机提供程序:
此元素是片段的根。
该元素是一个简单的元素,例如 pushbutton。
提供程序是重新定位占位符。
在其他情况下,该属性应返回 null。