demo-xf-app-1a/MobileApp1/Views/Content/LoadingIndicatorView.xaml.cs

47 lines
1.0 KiB
C#

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace MobileApp1.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LoadingIndicatorView : ContentView
{
public LoadingIndicatorView()
{
InitializeComponent();
}
public string Message
{
get => label1.Text;
set
{
Device.BeginInvokeOnMainThread(() =>
{
label1.Text = value;
});
}
}
public bool IsRunning
{
get => activityIndicator1.IsRunning;
set
{
Device.BeginInvokeOnMainThread(() =>
{
activityIndicator1.IsVisible = value;
activityIndicator1.IsRunning = value;
if (value)
{
label1.Text = string.Empty;
}
});
}
}
}
}