Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for JS root components in BlazorWebView #2293

Merged
merged 2 commits into from
Sep 1, 2021

Conversation

Eilon
Copy link
Member

@Eilon Eilon commented Aug 27, 2021

In each of .NET MAUI, WinForms, and WPF you register the dynamic components like so:

blazorWebView.RootComponents.RegisterForJavaScript<MyDynamicComponent>("my-dynamic-root-component");

And then in JS code you can dynamically add/remove components:

// Add
var component = await Blazor.rootComponents.add(containerElement, 'my-dynamic-root-component', { param1: 'value1' });

// Remove
component.dispose();

Fixes #1825

@Eilon
Copy link
Member Author

Eilon commented Sep 1, 2021

@SteveSandersonMS @javiercn can you please review?

@Eilon Eilon merged commit 83a4d0b into main Sep 1, 2021
@Eilon Eilon deleted the eilon/dynamic-root-components branch September 1, 2021 17:42
Csaba8472 added a commit to Csaba8472/maui that referenced this pull request Sep 6, 2021
* upstream/main: (326 commits)
  Re-enable interpreter on blazor by default
  Determine size of auto cells in GridLayout correctly when views occupy same cell (dotnet#2391)
  [main] Update dependencies from xamarin/xamarin-macios (dotnet#2326)
  [Android] Fix Horizontal Scrollbar Visibility (dotnet#2374)
  Try start vs4mac with local dotnet (dotnet#2386)
  [workoad] include missing dependencies in the workload (dotnet#2281)
  Update project templates to work with safe characters (dotnet#2368)
  [release/6.0.1xx-rc1] Update dependencies from xamarin/xamarin-android (dotnet#2369)
  Update dependencies from https://github.com/xamarin/xamarin-macios build 20210903.3 (dotnet#2384)
  Bump manifest to use api 31 (dotnet#2366)
  BoxView Handlers (dotnet#2250)
  Implement IsTextPredictionEnabled in WinUI Editor (dotnet#1478)
  Implement PlaceholderColor property in EntryHandlers (dotnet#1513)
  Automated dotnet-format update (dotnet#2355)
  Show entire search bar by default and make it not collapse (dotnet#2351)
  Remove test cloud if def for now (dotnet#2350)
  Add support for JS root components in BlazorWebView (dotnet#2293)
  Set base viewmapper to work against IViewHandler (dotnet#2339)
  NavigationView Handler for Android (dotnet#2336)
  Update OutputType to WinExe on -windows (dotnet#2340)
  ...
@Eilon Eilon added the area-blazor Blazor Hybrid / Desktop, BlazorWebView label Sep 30, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2023
@samhouts samhouts added the fixed-in-6.0.101-preview.10 Look for this fix in 6.0.101-preview.10! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView fixed-in-6.0.101-preview.10 Look for this fix in 6.0.101-preview.10!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for JS root components in BlazorWebView
3 participants