Slider Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Slider() |
Initializes a new instance of the Slider class. |
Slider(Double, Double, Double) |
Initializes a new instance of the Slider class. |
Slider()
- Source:
- Slider.cs
- Source:
- Slider.cs
Initializes a new instance of the Slider class.
public:
Slider();
public Slider ();
Public Sub New ()
Remarks
The following example shows a basic use.
using System;
using Microsoft.Maui.Controls;
namespace FormsGallery
{
class SliderDemoPage : ContentPage
{
Label label;
public SliderDemoPage()
{
Label header = new Label
{
Text = "Slider",
Font = Font.BoldSystemFontOfSize(50),
HorizontalOptions = LayoutOptions.Center
};
Slider slider = new Slider
{
Minimum = 0,
Maximum = 100,
VerticalOptions = LayoutOptions.CenterAndExpand
};
slider.ValueChanged += OnSliderValueChanged;
label = new Label
{
Text = "Slider value is 0",
Font = Font.SystemFontOfSize(NamedSize.Large),
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.CenterAndExpand
};
// Accomodate iPhone status bar.
this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);
// Build the page.
this.Content = new StackLayout
{
Children =
{
header,
slider,
label
}
};
}
void OnSliderValueChanged(object sender, ValueChangedEventArgs e)
{
label.Text = String.Format("Slider value is {0:F1}", e.NewValue);
}
}
}
Applies to
Slider(Double, Double, Double)
- Source:
- Slider.cs
- Source:
- Slider.cs
Initializes a new instance of the Slider class.
public:
Slider(double min, double max, double val);
public Slider (double min, double max, double val);
new Microsoft.Maui.Controls.Slider : double * double * double -> Microsoft.Maui.Controls.Slider
Public Sub New (min As Double, max As Double, val As Double)
Parameters
- min
- Double
The minimum selectable value.
- max
- Double
The maximum selectable value.
- val
- Double
The actual value.
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET MAUI