我正在进行MudBlazor的安装,我对安装指南中的以下代码行有一些问题...
using MudBlazor.Services;
builder.Services.AddMudServices();
winforms默认情况下不包含构建器,所以我修改了program.cs文件,如下图所示...
internal static class Program
{
public static IServiceProvider? ServiceProvider { get; set; }
static void ConfigureServices()
{
var services = new ServiceCollection();
services.AddMudServices();
ServiceProvider = services.BuildServiceProvider();
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
ConfigureServices();
Application.Run(new Form1());
}
}
1条答案
按热度按时间eni9jsuy1#
假设您已经正确设置了MudBlazor,按照Microsoft's website上的Blazor Winforms教程进行操作,看起来可以在窗体的构造函数中完成,如下所示: