Skip to content

Window sizes, systemtray icons, platform specific code etc.. #7257

Answered by cajmorgan
cajmorgan asked this question in Q&A
Discussion options

You must be logged in to vote

To help any other lost souls out there, I created a work around I'm more happy with than the default boilerplate:

In MauiProgram.cs

public static class MauiProgram
{
	public static MauiAppBuilder CreateMauiApp()
	{
		MauiAppBuilder builder = MauiApp.CreateBuilder();
		builder
			.UseMauiApp<App>()
			.ConfigureFonts(fonts =>
			{
				fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
			});

		builder.Services.AddMauiBlazorWebView();
#if DEBUG
		builder.Services.AddBlazorWebViewDeveloperTools();
#endif

		builder.Services.AddSingleton<WeatherForecastService>();

		return builder;
	}
}

This is the default boilerplate except that you return the builder instead of builder.Build(). The…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@cajmorgan
Comment options

@neilhewitt
Comment options

@cajmorgan
Comment options

Answer selected by cajmorgan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants