webassemblyuno-platform

Uno platform: How to implement custom control on Webassembly


Having multi-target project in Uno Platform, I would like to create Wasm specific control (HtmlView). I have found some hints this is just <div> HTML content on Wasm and I should derive from Control and call SetHtmlContent().

Unfortunately using the standard available references there is no Control (nor FrameworkElement - seen this in Uno documentation) having this method. Tried to add just a new class within Wasm head.

Am I supposed to reference some Uno specific "Controls for Webassembly Library" to derive from?

EDIT: I guess this is the one I need. Unfortunately the project is not based on Uno.UI, but Uno.WinUI. Might this be a problem?


Solution

  • So, it's not Control nor FrameworkElement, but it's UIElement and the SetHtmlContent() is extension method located in Windows.UI.Xaml.UIElementWasmExtensions class packaged in Uno.WinUI.Runtime.WebAssembly nuget.

    The inheritance is then: UIElement -> FrameworkElement -> Control.