In this tutorial series, we will see how to create a CardView in .Net MAUI using Border control. In .NET Maui provided Microsoft.Maui.Graphics library which provide us a consistent UI drawing API based on native graphics engines, thus making it easier for us to add borders, corners customisations, and shadows for most of the controls and layout contained in .NET MAUI. The new Border Control allows us to add Borders to a single element as a content (can be both a control and a Layout). This brings us a very flexible behavior to control of each corners: top-left, top-right, bottom-left, bottom-right, with our user interface, some of those cases can be adding the border to a button and rounding the upper left and lower right corners.
Quick Links:
Project Setup:
- Launch Visual Studio 2022, and in the start window click Create a new project to create a new project.
- In the Create a new project window, select MAUI in the All project types drop-down, select the .NET MAUI App template, and click the Next button:
- In the configure your new project window, name your project, choose a suitable location for it, and click the Next button:
- In the Additional information window, click the Create button:
- Once the project is created, we can able to see the Android, iOS, Windows and other running options in the toolbar. Press the emulator or run button to build and run the app
Implementation:
-
Open the MainPage.xaml file and add the following border control.
Border Properties
- We also having the StrokeShape property, which allows to modify the shape of the Stroke based on a Shape (the one you want), in addition to this Shape you can modify the edges as you need.
- We also add shadow property to apply in CardView.
- The final output will be like below when we come all the above properties come together.
0 comments:
Please Comment about the Posts and Blog