Bug 29110 - VerticalOptions = LayoutOptions.Center or CenterAndExpand, of Sliders on Windows Phone does not result in centered display
Summary: VerticalOptions = LayoutOptions.Center or CenterAndExpand, of Sliders on Wind...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows (show other bugs)
Version: 1.4.2
Hardware: PC Windows
: Normal minor
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-04-15 05:13 UTC by John Hardman
Modified: 2016-12-05 10:47 UTC (History)
3 users (show)

Tags: WindowsPhone WinPhone Slider VerticalOptions Center CenterAndExpand AC
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description John Hardman 2015-04-15 05:13:35 UTC
When Sliders are given VerticalOptions equal to Center of equal to CenterAndExpand, the result is as expected on iOS and Android, but not on Windows Phone. The code below can be used to demonstrate this. I would expect the Label and the Slider to consistently appear centered around the same vertical point. However, the Slider appears higher than expected. The same happens, whether embedded in a Grid, a StackLayout etc.


using Xamarin.Forms;

namespace SliderAlignmentIssue
{
    public class App : Application
    {
        public App()
        {
            Grid sliderGrid = new Grid
            {
                ColumnDefinitions =
                {
                    new ColumnDefinition { Width = GridLength.Auto },
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                },
                Children =
                {
                    { 
                        new Label 
                        { 
                            Text = "Label: ",
                            VerticalOptions = LayoutOptions.CenterAndExpand,
                            YAlign = TextAlignment.Center
                        }, 0, 1 
                    },
                    { 
                        new Slider 
                        {
                            VerticalOptions = LayoutOptions.CenterAndExpand,
                            BackgroundColor = Color.Blue,
                            Maximum = 255,
                            Minimum = 0
                        }, 1, 1
                    }
                }
            };

            // The root page of your application
            MainPage = new ContentPage
            {
                Content = sliderGrid
            };
        }

        protected override void OnStart()
        {
            // Handle when your app starts
        }

        protected override void OnSleep()
        {
            // Handle when your app sleeps
        }

        protected override void OnResume()
        {
            // Handle when your app resumes
        }
    }
}
Comment 1 John Miller [MSFT] 2016-01-04 19:01:43 UTC
I am able to reproduce this using the sample code and XF 2.0 on WP 8.
Comment 2 Rui Marinho 2016-12-05 10:47:25 UTC
Should le fixed in 2.3.4-pre2