Bug 29110

Summary: VerticalOptions = LayoutOptions.Center or CenterAndExpand, of Sliders on Windows Phone does not result in centered display
Product: Forms Reporter: John Hardman <jsh001guard-z659>
Component: WindowsAssignee: Bugzilla <bugzilla>
Status: RESOLVED FIXED    
Severity: minor CC: john.miller, jsh001guard-z659, rui.marinho
Priority: Normal    
Version: 1.4.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Tags: WindowsPhone WinPhone Slider VerticalOptions Center CenterAndExpand AC Is this bug a regression?: ---
Last known good build:

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