Project settings
jamesnet edited this page Nov 23, 2023
·
9 revisions
- NuGet 패키지 설치
- MainWindow using 선언
- BlazorWebView HostPage 설정
- wwwroot/index.html
- Services 설정
- ServiceProvider 생성
- Resources 추가 (DynamicResource)
- RootComponent 지정
- ComponentType
- Razor 컴포넌트 추가
- Selector
- id="app" 추가 (index.html)
- ComponentType
- 프로젝트 Sdk 변경
- Javascript 추가 (BlazorWebView)
- 의존성 주입 (SharedService)
- Data
- input 바인딩 추가
- @bind="sharedService.Data"
- OnDataChanged (event Action)
- @bind:event="oninput"
- _Imports.razor 추가
- 다중 컴포넌트 테스트
- StateHasChanged 추가
- override OnInitialized 선언
- OnDataChanged 이벤트 선언
Microsoft.AspNetCore.Components.WebView.Wpf
xmlns:blazor="clr-namespace:Microsoft.AspNetCore.Components.WebView.Wpf;assembly=Microsoft.AspNetCore.Components.WebView.Wpf"
wwwroot/index.html
var serviceCollection = new ServiceCollection();
serviceCollection.AddWpfBlazorWebView();
var serviceProvider = serviceCollection.BuildServiceProvider();
Resources.Add("services", serviceProvider);
<blazor:BlazorWebView.RootComponents>
<blazor:RootComponent ComponentType="{x:Type }"/>
</blazor:BlazorWebView.RootComponents>
<div id="app">Loading...</div>
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Project Sdk="Microsoft.NET.Sdk.Razor">
<script src="_framework/blazor.webview.js"></script>
@using Microsoft.AspNetCore.Components.Web