microsoft / microsoft-ui-xaml

WinUI: a modern UI framework with a rich set of controls and styles to build dynamic and high-performing Windows applications.
MIT License
6.38k stars 683 forks source link

How do I obtain the DesktopSiteBridge object in an instance of the WinUI 3 Window class? #10082

Open Gaoyifei1011 opened 1 month ago

Gaoyifei1011 commented 1 month ago

How do I obtain the DesktopSiteBridge object in an instance of the WinUI 3 Window class?

-------------------------------

如何获取 WinUI 3 Window 类实例下的 DesktopSiteBridge 对象?


WinUI 3 的 Window 类的实例是对 DesktopWindowXamlSource 创建窗口的一个高级包装,如何在 Window 类实例中获取 DesktoSiteBridge 对象?我在 WinUI 3 源代码中发现了 IContentIslandPartner 接口,通过这个接口可以把 ContentIsland 对象转换为 DesktopSiteBridge 对象,请问一下这个接口该怎么实现呢?

-------------------------------

The Window class instance of WinUI 3 is a high-level wrapper for the DesktopWindowXamlSource creation Window. How to obtain the DesktoSiteBridge object in the Window class instance? I found IContentIslandPartner interface in WinUI 3 source code, through which ContentIsland object can be converted to DesktopSiteBridge object, may I ask how to implement this interface?


Image https://github.com/microsoft/microsoft-ui-xaml/blob/d74a0332cf0d5e58f12eddce1070fa7a79b4c2db/src/dxaml/xcp/dxaml/lib/XamlRoot_Partial.cpp#L284

Lightczx commented 1 month ago

What's the point? most methods DesktopSiteBridge defined are exposed via AppWindow.