question

hosseintavakoli-7723 avatar image
0 Votes"
hosseintavakoli-7723 asked JessieZhang-2116 commented

Xamarin forms vertical slider

I want a vertical slider placed left of screen.
I use this code :

 <Grid x:Name="grdCameraViewer" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
    
                 <Slider x:Name="sldCameraZoomValue" Maximum="50.0" Minimum="10.0"
                         VerticalOptions="Center" HorizontalOptions="FillAndExpand" Margin="0" Rotation="-90" />
    
 </Grid>

it work for vertical slider, but I cannot put it left of screen.it placed center of screen.

dotnet-xamarin
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @hosseintavakoli-7723 , I have not heard from you for a couple of days. Please let me know if there is anything that I can help here.

0 Votes 0 ·
PRASANTMOHANTY-6840 avatar image
0 Votes"
PRASANTMOHANTY-6840 answered
  1. Use VerticalOptions="Left".

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JessieZhang-2116 avatar image
0 Votes"
JessieZhang-2116 answered JessieZhang-2116 commented

Hello,


Welcome to our Microsoft Q&A platform!

Just change the HorizontalOptions of your Grid to Start:

 <ContentPage.Content>
     <Grid x:Name="grdCameraViewer" HorizontalOptions="Start" VerticalOptions="FillAndExpand">

         <Slider x:Name="sldCameraZoomValue" Maximum="50.0" Minimum="10.0"
                      VerticalOptions="Center" HorizontalOptions="FillAndExpand" Margin="0" Rotation="-90" />

     </Grid>
 </ContentPage.Content>

Note: At this time ,we will find the slider is very small .
107018-image.png

As a test, when I increased the width and height as follows:

 <Grid x:Name="grdCameraViewer" HorizontalOptions="Start" VerticalOptions="FillAndExpand" BackgroundColor="Gray">
     <Slider x:Name="sldCameraZoomValue" Maximum="50.0" Minimum="10.0" WidthRequest="300" HeightRequest="50" BackgroundColor="Yellow"
                   VerticalOptions="Center" HorizontalOptions="FillAndExpand" Margin="0" Rotation="-90" />
 </Grid>

The result is:

107017-image.png

We will find that as the width and height of the slider increases, so does the distance to the left of the slider.
This means that when the horizontal slider is adjusted to be vertical, the slider still occupies the corresponding width in the horizontal direction.



Best Regards,


Jessie Zhang


If the response is helpful, please click "Accept Answer" and upvote it.



Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



image.png (7.2 KiB)
image.png (7.9 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @hosseintavakoli-7723 , I have not heard from you for a couple of days. Please let me know if there is anything that I can help here.

0 Votes 0 ·