VB.NET, C#, PowerShellを使用しているエンジニアのためのサイト。
基本的な使用方法から開発で役立つTipsまで幅広く取り扱っています。
Update 2019/04/13
Sliderはつまみをスライドさせて、数値入力をするためのコントロールです。
主なプロパティには以下のものがあります。
プロパティ | 説明 |
---|---|
Value | 現在値 |
Minimum | 選択可能な範囲の最小値 |
Maximum | 選択可能な範囲の最大値 |
以下はXamlにおける Slider コントロールの使用例です(9行目)。
<?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:sliderSample01"
x:Class="sliderSample01.MainPage">
<StackLayout HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand">
<Slider Value="10" Minimum="-100" Maximum="100" WidthRequest="300" />
</StackLayout>
</ContentPage>
次に、コードビハインドでの実装例を以下に示します。
現在値に 10 を設定し、つまみの可動範囲を -100 〜 100 にしています。
namespace sliderSample01
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
this.slider.Minimum = -100;
this.slider.Maximum = 100;
this.slider.Value = 10;
}
}
}
実行例を以下に示します。