aokocax Software developer, develops tools and projects, likes startups.

Methods for dividing the layout into equal parts in .net MAUI

You can divide the screen into equal parts in several different ways using XAML. Although Grid View is usually used for this process, it is possible to do this without using Grid.
Using the method StackLayout
Split the screen horizontally

Split the screen horizontally into three parts

Split the screen vertically into three parts

Finding the full width of the screen in .net MAUI.

Especially when we want a view to have full width in the screen, we need to know the width of the screen in terms of DPU/DPR. It's not possible to do this with a fixed number as Full WidthRequest is different on each device. By learning the Density of the device in MAUI, you can learn the required number to have full width with WidthRequest;
var pixelWidth=DeviceDisplay.Current.MainDisplayInfo.Width; //pixel width
var density=DeviceDisplay.Current.MainDisplayInfo.Density; // density
var fullWidthRequest=pixelWidth/density; //FullWidthRequest

Showing an intro page when an app is first installed in .net MAUI.

In many applications, we use the intro page to inform users about the application when the application is first installed. You can do this by registering a preference when the application is first opened. I am sharing the code block as an example.
    public App()
        string guid = Preferences.Default.Get("guid", "");
        if (string.IsNullOrEmpty(guid))
            Preferences.Default.Set("guid", Guid.NewGuid().ToString());
            MainPage = new IntroPage();
            MainPage = new MainPage();


MAUI carousel view sample

var hvm = new HomeViewModel();,
hvm= applicationService.GetHomeViewModel(true,  0,  cat.url); 
return View("index",hvm);

ss " s

MAUI Samples Repository

I have opened a public Github repo where I can share the solutions I have reached while working with MAUI.
On the one hand, I am planning to update the repo while making its explanations on my blog. I will try to keep it at the beginner level as much as possible, but I plan to include difficult topics from time to time. You can access the repository here.

Hello World

I am reopening my personal blog, which I have not been able to update for a long time, with my own coded blog infrastructure.
In the future, I plan to open the source codes in case of demand.
For now, my old articles are not published, but I am planning to add them gradually.
I wish everyone good

Press ESC to close