progress bar

main
syneffort 2 years ago
parent e1bd17b32f
commit b5b428b41c
  1. 7
      XamarinStudy/XamarinStudy/XamarinStudy/Views/SampleElementPage1.xaml
  2. 3
      XamarinStudy/XamarinStudy/XamarinStudy/Views/SampleElementPage1.xaml.cs
  3. 17
      XamarinStudy/XamarinStudy/XamarinStudy/Views/SampleElementPage2.cs

@ -15,10 +15,13 @@
<Entry Placeholder="Input Text" TextColor="Salmon" FontSize="Large" FontAttributes="Bold" Keyboard="Text"/>
<Entry Placeholder="Input Number" BindingContext="{x:Reference stepper1}" TextColor="Red" FontSize="{Binding Value}" FontAttributes="Bold" Keyboard="Numeric"/>
<Editor Placeholder="Input Message" BindingContext="{x:Reference slider1}" Rotation="{Binding Value}" TextColor="Red" BackgroundColor="{OnPlatform Android=Blue,UWP=White}" FontSize="{Binding Value}" FontAttributes="Bold" HeightRequest="250"/>
<Editor Placeholder="Input Message" BindingContext="{x:Reference slider1}" Rotation="{Binding Value}" TextColor="Red" BackgroundColor="{OnPlatform Android=Blue,UWP=White}" FontSize="{Binding Value}" FontAttributes="Bold" HeightRequest="100"/>
<Slider x:Name="slider1" Maximum="100" Minimum="10" Value="15" MinimumTrackColor="Salmon" MaximumTrackColor="DarkRed"/>
<Slider x:Name="slider1" Maximum="100" Minimum="0" Value="0" MinimumTrackColor="Salmon" MaximumTrackColor="DarkRed"/>
<Stepper x:Name="stepper1" Maximum="50" Minimum="5" Increment="5" Value="20" ValueChanged="stepper1_ValueChanged"/>
<ProgressBar x:Name="pb1" ProgressColor="Orange"/>
<ProgressBar x:Name="pb2" ProgressColor="Red"/>
<ProgressBar x:Name="pb3" ProgressColor="Green"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>

@ -29,6 +29,9 @@ namespace XamarinStudy.Views
private void stepper1_ValueChanged(object sender, ValueChangedEventArgs e)
{
lbl1.Text = e.NewValue.ToString("N2");
pb1.ProgressTo(e.NewValue/100, 1000, Easing.SpringIn);
pb2.ProgressTo(e.NewValue/100, 1000, Easing.SpringOut);
pb3.ProgressTo(e.NewValue/100, 1500, Easing.BounceOut);
}
}
}

@ -21,7 +21,7 @@ namespace XamarinStudy.Views
Editor editor = new Editor()
{
Placeholder = "Multi-line input",
HeightRequest = 300
HeightRequest = 100
};
if (Device.RuntimePlatform == Device.UWP)
{
@ -44,6 +44,17 @@ namespace XamarinStudy.Views
};
slider.ValueChanged += (s, e) => editor.Text = e.NewValue.ToString("N2");
ProgressBar progressBar = new ProgressBar() { ProgressColor = Color.Coral };
Stepper stepper = new Stepper()
{
Maximum = 10,
Minimum = 0,
};
stepper.ValueChanged += (s, e) =>
{
progressBar.ProgressTo(e.NewValue / 10, 1500, Easing.BounceOut);
};
Content = new StackLayout
{
Children =
@ -52,7 +63,9 @@ namespace XamarinStudy.Views
label1,
label2,
editor,
slider
slider,
stepper,
progressBar
}
};
}

Loading…
Cancel
Save