dotnetCampus.UISpy.Uno is a tool for inspecting the runtime visual tree of a Skia platforms Uno app.
The reason for needing this tool is that on the Skia platform, both WPF and GTK and X11 uses a Surface to render the interface. This results in the original WPF UI debugging tools, such as SnoopWpf, only being able to see an image and not being able to obtain the correct interface structure. dotnetCampus.UISpy.Uno can effectively assist in interface development debugging on Skia-based desktop platforms, such as Skia.Wpf and Skia.Gtk and Skia.X11 and so on, enhancing the efficiency of developers' interface development, especially when debugging Skia.Gtk or Skia.X11 applications on the Linux desktop.
In the project where the UI interface is to be debugged, follow these preparation steps:
- Install the NuGet package named dotnetCampus.UISpy.Uno.
- Add a Grid control named SnoopRootGrid at the top level of the UI interface for subsequent display of the highlighted area. Please do not put any business logic interface in SnoopRootGrid, as the content of this SnoopRootGrid will be constantly cleared.
- Use the
AttachDevTools
method of theDevToolsExtensions
static type in thedotnetCampus.UISpy.Uno
namespace, and passthis
as a parameter to complete the preparation work. Here is an example code:
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
#if HAS_UNO
this.AttachDevTools();
#endif
}
}
After completing the above preparation work, you can run the project, press F12 to debug the UI interface.
Thank you snoopwpf, this is the inspiration for this tool.