From ac549b36c354b72cbddc524c93635c526c233449 Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Fri, 23 Dec 2022 04:33:31 -0600 Subject: [PATCH] Clarify location of InitializeComponent method (#27962) --- aspnetcore/blazor/hybrid/tutorials/windows-forms.md | 5 ++++- aspnetcore/blazor/hybrid/tutorials/wpf.md | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/aspnetcore/blazor/hybrid/tutorials/windows-forms.md b/aspnetcore/blazor/hybrid/tutorials/windows-forms.md index c5af60765a..ba35c1161b 100644 --- a/aspnetcore/blazor/hybrid/tutorials/windows-forms.md +++ b/aspnetcore/blazor/hybrid/tutorials/windows-forms.md @@ -221,7 +221,7 @@ using Microsoft.AspNetCore.Components.WebView.WindowsForms; using Microsoft.Extensions.DependencyInjection; ``` -Inside the `Form1` constructor, after the `InitializeComponent()` method call, add the following code: +Inside the `Form1` constructor, after the `InitializeComponent` method call, add the following code: ```csharp var services = new ServiceCollection(); @@ -231,6 +231,9 @@ blazorWebView1.Services = services.BuildServiceProvider(); blazorWebView1.RootComponents.Add("#app"); ``` +> [!NOTE] +> The `InitializeComponent` method is generated by a source generator at app build time and added to the compilation object for the calling class. + The final, complete C# code of `Form1.cs`: ```csharp diff --git a/aspnetcore/blazor/hybrid/tutorials/wpf.md b/aspnetcore/blazor/hybrid/tutorials/wpf.md index b17ace9b3f..509dec852c 100644 --- a/aspnetcore/blazor/hybrid/tutorials/wpf.md +++ b/aspnetcore/blazor/hybrid/tutorials/wpf.md @@ -234,7 +234,7 @@ Add the namespace [!NOTE] +> The `InitializeComponent` method is generated by a source generator at app build time and added to the compilation object for the calling class. + The final, complete C# code of `MainWindow.xaml.cs`: ```csharp