Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the Progress property to set the current progress in Xamarin XAML language

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to use the Progress property to set the current progress in the Xamarin XAML language, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

The Xamarin XAML language tutorial uses the Progress property to set the current progress

In addition to using the Progress property in XAML to set the current progress of the progress bar, developers can also use the Progress property in the code-behind file to set the current progress of the progress bar. At this point, you first need to define a name for the progress bar using the x:Name property in the XAML file, and then set the Progress property with the defined name in the code-behind file.

[example 12-7:ProgressBarProgressOne] the following will implement the current settings for the progress bar in the code-behind file. The specific steps are as follows:

(1) MainPage.xaml file, write code, layout the content page. The code is as follows:

(2) Open the MainPage.xaml.cs file, write code, and realize the function of controlling the current progress of the progress bar through buttons. The code is as follows:

Using System

Using System.Collections.Generic

Using System.Linq

Using System.Text

Using System.Threading.Tasks

Using Xamarin.Forms

Namespace ProgressBarProgressOne

{

Public partial class MainPage: ContentPage

{

Public MainPage ()

{

InitializeComponent ()

}

/ / set the current progress of the progress bar to 0.2

Void SetProgressPointTwo (object sender, EventArgs args)

{

ProgressBar.Progress = 0.2

}

/ / set the current progress of the progress bar to 0.6

Void SetProgressPointSix (object sender, EventArgs args)

{

ProgressBar.Progress = 0.6

}

/ / set the current progress of the progress bar to 1

Void SetProgressOne (object sender, EventArgs args)

{

ProgressBar.Progress = 1

}

}

}

When you run the program at this point, you will see the effect shown in figure 12.24-12.25. When the developer taps a button, the corresponding progress is displayed in the progress bar, and the effect is similar to that shown in figure 12.24-12.25.

Figure 12.24 Android running effect figure 12.25 iOS running effect

The above is all the content of the article "how to use the Progress property to set the current progress in the Xamarin XAML language". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report