Click here for English version
Danish version:
Maksimér knappen i titlebjælken, udvider vinduet til at fylde skærmen. "Super Maksimér" tager den et skridt videre og maksimerer vinduet til alle skærme, forudsat at skærmene er konfigureret til at udvide skrivebordet.
Dette repository viser, hvordan du kan tilføje en knap til titelbjælken, og "Super Maksimér" funktionaliteten til din applikation.
Bemærk venligst, at "Super Maksimér" funktionaliteten ikke er specifik for .NET MAUI Blazor Hybrid applikationer. Den kan også bruges i andre typer af Windows GUI applikationer, fx WPF og WinForms.
Eksemplet tager afsæt i applikationen fra mit repo "Change Title and Subtitle in a ,NET MAUI Blazor Hybrid Windows application".
-
Tilføj klassen
SuperMaximizeForWindows.cstil din .NET MAUI Blazor Hybrid applikation -
Tilføj klassen
TitleBarTools.cstil din .NET MAUI Blazor Hybrid applikation -
Implementer
TitleBarServiceklassen -
Implementer
TitleBarToolsklassen -
Registrer
TitleBarServiceiMauiProgram.csfilen -
Tilret
App.xaml.csfilen der ligger i roden, så den opretter et TitleBar objekt og kalder metoden BuildTitleBar i SuperMaximizeForWindows klassen. Denne metode tilføjer knappen og implementerer "Super Maksimér" funktionaliteten -
I App.xaml.cs skal du også koble ind i event'et "window.Created" for at få de initielle værdier for vinduets position og størrelse
Kik i koden for at se, hvordan det hele hænger sammen.
Du kan kopiere de relevante filer og kodebidder fra dette repository til dine egne .NET MAUI Blazor Hybrid projekter, eller din værktøjskasse, så har du det klar og skal kun angive et minimum af kode.
Venligst læs dokumentet "Acknowledgements.md".
The Maximize button in the title bar expands the window to fill the screen. 'Super Maximize' takes it a step further and maximizes the window across all screens, provided the screens are configured to extend the desktop.
This repository demonstrates how to add a button to the title bar and implement the 'Super Maximize' functionality in your application.
Please note that the 'Super Maximize' functionality is not specific to .NET MAUI Blazor Hybrid applications. It can also be used in other types of Windows GUI applications, such as WPF and WinForms.
The example is based on the application from my repository 'Change Title and Subtitle in a .NET MAUI Blazor Hybrid Windows application'.
-
Add the class
SuperMaximizeForWindows.csto your .NET MAUI Blazor Hybrid application. -
Add the class
TitleBarTools.csto your .NET MAUI Blazor Hybrid application. -
Implement the
TitleBarServiceclass. -
Implement the
TitleBarToolsclass. -
Register
TitleBarServicein theMauiProgram.csfile. -
Modify the
App.xaml.csfile located in the root so that it creates a TitleBar object and calls the -
BuildTitleBarmethod in theSuperMaximizeForWindowsclass. This method adds the button and implements -
the "Super Maximize" functionality.
-
In
App.xaml.cs, you must also hook into thewindow.Createdevent to obtain the initial values for the -
window's position and size.
Check the code to see how everything fits together.
You can copy the relevant files and code snippets from this repository to your own .NET MAUI Blazor Hybrid projects or your personal toolbox. This way, you have it ready and only need to provide a minimum of code.
Please read the document 'Acknowledgements.md'.
