Crafting the Page Layout
Great applications start with a good idea and a vision of what users will see on the screen. I won’t be able to come up with an idea for your app, but I can help you avoid expending your energy when you get around to creating the user interface. While crafting the page layout may seem like a basic topic, many professional developers waste considerable time during this step or create views with performance/UX issues.
In this chapter, we’ll create the main layout types you’ll mostly need in .NET MAUI applications, learn how to avoid pitfalls, and delve into details of the algorithm for arranging UI elements.
By the end of this chapter, you will be able to create simple, advanced layouts with your custom arranging mechanism. We will create adaptive views for both desktop and mobile devices. You will get a deep understanding of how the .NET MAUI layout mechanism works, which will help you always make the right choice on what panel works best in your specific scenario.
In this chapter, we’ll be covering the following recipes:
- Creating horizontal/vertical layouts
- Creating grid layouts
- Creating scrollable layouts
- Implementing device-specific layouts
- Implementing layouts with dynamic orientation
- Building a layout dynamically based on a collection
- Implementing a custom arranging algorithm