AutomationPeer.GetHostRawElementProviderCore Method

Definition

告知 UI 自动化UI AutomationUI 自动化UI Automation 树中何处放置由 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 元素托管的 hwndTells UI 自动化UI Automation where in the UI 自动化UI Automation tree to place the hwnd being hosted by a Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) element.

protected:
 virtual System::Windows::Automation::Peers::HostedWindowWrapper ^ GetHostRawElementProviderCore();
protected virtual System.Windows.Automation.Peers.HostedWindowWrapper GetHostRawElementProviderCore ();
[System.Security.SecurityCritical]
[System.Security.SecurityTreatAsSafe]
protected virtual System.Windows.Automation.Peers.HostedWindowWrapper GetHostRawElementProviderCore ();
abstract member GetHostRawElementProviderCore : unit -> System.Windows.Automation.Peers.HostedWindowWrapper
override this.GetHostRawElementProviderCore : unit -> System.Windows.Automation.Peers.HostedWindowWrapper
Protected Overridable Function GetHostRawElementProviderCore () As HostedWindowWrapper

Returns

HostedWindowWrapper

此方法会将托管的 hwnd 返回到托管 hwnd 对象的控件的 UI 自动化UI AutomationThis method returns the hosted hwnd to UI 自动化UI Automation for controls that host hwnd objects.

Attributes

Remarks

此方法会将托管的 hwnd 返回到托管 hwnd 对象的控件的 UI 自动化UI AutomationThis method returns the hosted hwnd to UI 自动化UI Automation for controls that host hwnd objects.

与直接承载 hwnd 的元素关联的 AutomationPeer 必须重写此方法。The AutomationPeer that is associated with an element that immediately hosts an hwnd must override this method.

如果未重写此方法,UI 自动化UI Automation 会将 hwnd 作为承载整个应用程序的 HwndSource 的子元素。If this method is not overridden, UI 自动化UI Automation places the hwnd as a child element of the HwndSource that hosts the whole application. 通常,你希望重写此默认行为,并将 UI 自动化UI Automation 设置为将承载的 hwnd 并行定位到它在 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 逻辑树中的位置。Typically, you want to override this default behavior and set UI 自动化UI Automation to position the hosted hwnd parallel to the place where it is located in the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) logical tree.

除宿主方案外,不允许 AutomationPeer 类型重写此方法。Except in hosting scenarios, do not allow AutomationPeer types to override this method.

除了重写此方法以外,与立即承载 hwnd 的元素关联的 AutomationPeer 类型必须返回强制转换为 IRawElementProviderSimpleAutomationPeer,以响应承载 WM_GETOBJECT 的 hwndIn addition to overriding this method, the AutomationPeer types that are associated with an element that immediately hosts an hwnd must return the AutomationPeer that is cast to IRawElementProviderSimple in response to WM_GETOBJECT coming to the hosted hwnd.

若要获取指向 IRawElementProviderSimple的指针,请调用 HostProviderFromHandleTo get a pointer to IRawElementProviderSimple, call HostProviderFromHandle.

Applies to

See also