Hello,
===============Update=============
how I can remove the upper part where the controls are located to minimize and close the window and the program only on the ScreenPage and on the LoginPage to put my own I attached an image pointing in red to specify
This feature is added in the github page, please track on this feature :Provide a cross platform API for customizing the TitleBar of desktop apps
how can I change the size of the window, the splash screen one size, the login screen another, etc.
You can keep the code in the splash screen, then use the following code to change the window size for login page.
protected override void OnHandlerChanged()
{
base.OnHandlerChanged();
#if WINDOWS
Microsoft.UI.Xaml.Window window = (Microsoft.UI.Xaml.Window)App.Current.Windows.First<Window>().Handler.PlatformView;
IntPtr windowHandle = WinRT.Interop.WindowNative.GetWindowHandle(window);
Microsoft.UI.WindowId windowId = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(windowHandle);
Microsoft.UI.Windowing.AppWindow appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(windowId);
appWindow.Resize(new Windows.Graphics.SizeInt32(800, 600));
#endif
}
you can create a contentpage as a splash screen to load data before navigating to the login page. Here’s an example of how you can achieve this:
Create a new XAML page for the splash screen (SplashScreenPage.xaml) with an image to display while the data is being loaded.
In the code-behind file (SplashScreenPage.xaml.cs), use the OnAppearing method to load the necessary data. You can use asynchronous methods to fetch the data from a remote server or perform any other initialization tasks. Once the data loading is complete, navigate to the login page.
public partial class SplashScreenPage : ContentPage
{
public SplashScreenPage()
{
InitializeComponent();
}
protected override async void OnAppearing()
{
base.OnAppearing();
// Load data or perform initialization tasks
await LoadData();
// Navigate to the login page
await Navigation.PushModalAsync(new LoginPage());
}
private async Task LoadData()
{
// Perform data loading tasks here
// For example, fetching data from a remote server
await Task.Delay(2000); // Simulating a delay here, replace with your actual data loading logic
}
}
In your App.xaml.cs file, set the SplashScreen property to the SplashPage you created. This will ensure that the splash screen is displayed when the app starts.
public App()
{
InitializeComponent();
MainPage = new SplashScreenPage();
}
For other platforms, if you want to remove the splash screen from MAUI, you can open your .csproj
file, remove <MauiSplashScreen>
tag.
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.