Category / Section
How to change the Orientation of SfRangeSlider in Xamarin.Forms
1 min read
Syncfusion SfRangeSlider allows us to change its orientation to Vertical or Horizontal. The code snippets and the steps to be followed to change the slider’s orientation is given below.
To change the Slider’s orientation, follow the given procedure:
Step 1: Add all the necessary assemblies as instructed in our helping document.
Step 2: Create instance of SfRangeSlider and use Orientation property to set desire orientation. Default orientation will be Vertical
The below code illustrates the way to achieve this
Code snippet:
Xaml Code:
<ContentPage.Content> <StackLayout x:Name="stack" Orientation="Vertical"> <slider:SfRangeSlider x:Name="range" SnapsTo="None" Orientation="Horizontal" Minimum="0" Maximum="100" ShowRange="true"> </slider:SfRangeSlider> </StackLayout> </ContentPage.Content>
C# Code:
SfRangeSlider slider = new SfRangeSlider(); slider.Minimum = 0; slider.Maximum = 100; slider.Orientation = Orientation.Horizontal; slider.ShowRange = true; slider.SnapsTo = SnapsTo.None; StackLayout stack = new StackLayout(); stack.Padding = new Thickness(20, 50); stack.Children.Add(slider); this.Content = stack;
SfRangeSlider in Horizontal orientation SfRangeSlider in Vertical orientation