Blazor support
how can you use blazor?
Best regards
You would need to build a standalone static blazor wasm page. You can load this page like any other HTML webside using
window.SetRootFolder("blazor_wasm_folder");
window.Show("index.html");
On the blazor side you would need to include webui.js in the main layout and you can either use the WebUI api using JavaScript/TypeScript or build a C# wrapper using JsImport.
could you create an example?
Thank you
Creating an example would propably not be very helpful as i ddn't find a way to get WebUI to always build the blazor wwwroot and copy it to it's own output. However here are some more detailed steps:
- Create a blazor wasm project and add
<script src="/webui.js"></script>to the index.html located in the wwwroot folder. - Now to the tricky part: Blazor wasm only builds its full static output on publish builds, so if you're ready you can publish your blazor project and copy the contents of the wwwroot folder to the WebUI project.
- On the WebUI side the easiest example to follow would propably be the text editor, you can just delete the ui folder and replace it with wwwroot. and change the .csproj and Program.cs accordingly. Also if you're building this as a finished app you can remove the local nuge includes and just replace them with normal ones.
- You can use the WebUI api like you would normally. In the blazor side just use javascript invokes or JsImport to call your backend methods. js invokes would propably be easier as you will need to work with promises when calling backend functions. to learn more i recommend taking a look at the webui documentation
I will keep this issue open until i find a way to build a blazor project in such a way it will automatically be copied to the WebUI project. because while you could build a script i don't think thats an optimal solution.