In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the Xamarin XAML language how to use Visual Studio to create XAML, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
Xamarin.Forms allows developers to customize all the user interface elements of the program in detail through XAML syntax, such as text, buttons, images, and list boxes. At the same time, developers can also use it to rationalize the layout of the entire interface. Building UI interface through XAML has the advantages of simplicity and visualization, which is very suitable for the application architecture of MVVM. This chapter will explain the basic contents of the XAML language, including an introduction to the XAML language, the creation of XAML files, XAML file composition, element composition, and so on.
Brief introduction of XAML language
XAML is the English abbreviation of Extensible Application Markup Language, and the corresponding Chinese name is Extensible Application markup language. It is a new descriptive language created by Microsoft to build application user interface. It is based on Extensive Markup Language (XML) Extensible markup language. XAML provides a syntax that is easy to extend and locate to define a user interface that is separate from the program logic, and this implementation is very similar to the "code post" model in ASP.NET. XAML is an interpretive language, although it can also be compiled. Its advantage is to simplify the user creation process on the program, add code and configuration when applying, and so on.
Create a XAML file
In Xamarin.Forms, the XAML code is saved in the XAML file. When writing XAML code, developers first need to create the corresponding XAML file. This section explains how to use two development tools to create XAML files. The first is to create a XAML; using Visual Studio, and the second is to create a XAML using Xamarin Studio.
Create a XAML using Visual Studio
There are two ways to create a XAML file using Visual Studio. The first is to create the XAML file after you create the project, and the second is to create the XAML file when you create the project. These two ways are described in detail below.
1. Create the XAML file after creating the project
Taking the creation of a project Hello as an example, we will explain the specific steps for developers to create a XAML file after creating a project of PCL type:
(1) Open Visual Studio, as shown in figure 1.1.
(2) Click "New Project …" Button to bring up the New Project interface, as shown in figure 1.2.
Figure 1.1 start VS
(3) Select the Blank App (Xamarin.Forms Portable) template under Cross-Plaform, and modify the name and location. Here, we change the name to Hello and the location to D:\ Code\ XAML.
Figure 1.2 New Project interface
(4) Click the "OK" button, and a project named Hello is created.
(5) right-click the Hello (portable) project and pop up the shortcut menu, as shown in figure 1.3.
Figure 1.3 menu
(6) Select "add (D)" in the pop-up shortcut menu | "New item (W) …" Command, and the add New item-Hello interface pops up, as shown in figure 1.4.
Figure 1.4 "add New item-Hello" interface
(7) Select the Forms Xaml Page item under Cross-Platform and change the name to XAMLPage.xaml.
Note: if the developer does not change the name in figure 1.4, the default is Page1.xaml.
(8) Click the "add (A)" button, and a XAML file is created with the name XAMLPage, as shown in figure 1.5.
Figure 1.5 XAMLPage.xaml file
Note: in this version of Xamarin, creating XAML files based on Share type projects is not supported.
two。 Create a XAML file when you create a project
In Visual Studio, creating a XAML file when you create a project is one of the most common and easiest ways. Taking Hello as an example, we will explain the specific steps for developers to create XAML files when creating a project:
(1) find Visual Studio on your computer and open it to show.
(2) Select "New Project …" Button to bring up the New Project interface, as shown in figure 1.6.
(3) Select the Blank Xaml App (Xamarin.Forms Portable) template under Cross-Plaform, and modify the name and location. Here, we change the name to Hello and the location to D:\ Code\ XAML.
Figure 1.6 New Project interface
(4) Click the "OK" button, and a project named Hello is created. We can see that there is a XAML file in the project created, and the name of this file is MainPage.xaml, as shown in figure 1.7.
Figure 1.7 MainPage.xaml file
Note: if the developer wants to create another XAML file in this project, you need to follow steps 5 through 7 in section 1.2.1.
Thank you for reading this article carefully. I hope the article "how to use Visual Studio to create XAML in Xamarin XAML language" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.