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 set the progress bar by ProgressTo method 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--

This article mainly introduces how to set the progress bar through the ProgressTo method in the Xamarin XAML language, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.

A ProgressTo method is defined in ProgressBar, which can also be used to set the current progress bar. The difference between ProgressTo and Progress properties is that ProgressTo provides animation. The ProgressTo method must be used in the code file, not in the XAML file. Its grammatical form is as follows:

ProgressBarObject. ProgressTo (value, length, easing)

The parameters are described as follows:

Value: indicates the current progress of the setting.

Length: indicates how long it takes to reach the set value (milliseconds).

Easing: represents the animation effect.

[example 12-9:ProgressBarProgressThree] the following will use the ProgressTo method to set the current progress of the progress bar. 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 set the current progress of the progress bar. 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 ProgressBarProgressThree

{

Public partial class MainPage: ContentPage

{

Public MainPage ()

{

InitializeComponent ()

}

/ / set the current progress of the progress bar

Void SetProgresse (object sender, EventArgs args)

{

ProgressBar.ProgressTo (1.0,2500, Easing.Linear)

}

}

}

When you run the program at this point, you will see the effect shown in figure 12.32-12.33. When the developer taps the PlayProgressAnimate button, the progress bar implements the loaded animation, similar to the one shown in figure 12.34-12.35. The loading animation is completed after 2.5 seconds, and the current progress of the progress bar will be 1.

Figure 12.32 Android running effect figure 12.33 iOS running effect

Thank you for reading this article carefully. I hope the article "how to set the progress bar through the ProgressTo method in Xamarin XAML language" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support 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.

Share To

Internet Technology

Wechat

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

12
Report