XF 滑块和步进控件
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:App21"
x:Class="App21.MainPage">
<StackLayout VerticalOptions="Center">
<Label x:Name="myLabel"></Label>
<Slider x:Name="mySlider" Minimum="0" Maximum="100" Value="0" ValueChanged="mySlider_ValueChanged"></Slider>
<Stepper Minimum="0" Maximum="100" ValueChanged="Stepper_ValueChanged"></Stepper>
</StackLayout>
</ContentPage>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace App21
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
private void mySlider_ValueChanged(object sender, ValueChangedEventArgs e)
{
myLabel.Text = mySlider.Value.ToString();
}
private void Stepper_ValueChanged(object sender, ValueChangedEventArgs e)
{
myLabel.Text =((Stepper)sender).Value.ToString();
}
}
}