Bug 60921 - Text Change And Repositioning Happens In Two Steps
Summary: Text Change And Repositioning Happens In Two Steps
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.5.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-11-30 09:05 UTC by Hakan
Modified: 2017-12-01 04:50 UTC (History)
2 users (show)

Tags: label, alignment, 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 for Bug 60921 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Hakan 2017-11-30 09:05:04 UTC
On the page layout, there is a label which is aligned right via HorizontalOptions="EndAndExpand". The content of the sliderLabel is changed as the slider is moved. This causes the text to move back and forth after each change before it settles to its final position For example, when it transitions from 5 to 5.5, at first, text is changed without changing the start position of the first character, then it is repositioned by a sudden left move to fit the extra characters into the stack layout. In short, first the text changes in place, and then positioned according to the new text length.

I see this with Samsung Galaxy S3 and the Android simulator. I don't see it on iPhone. It may be because ıf the speed of the hardware that it is not noticed on iPhone. So, it might be better to test it on a rather slower hardware or on a simulator. 


<StackLayout Orientation="Horizontal" Padding="15,10,15,10" Spacing="20">
       <Label Text="Hello"><Label>
       <Label x:Name="sliderLabel" HorizontalOptions="EndAndExpand"><Label>                      
<Slider x:Name="slider" HorizontalOptions="FillAndExpand"><Slider>

Page Constructor content:

	slider.Minimum = 0f;
        slider.Maximum = 20f;
        slider.ValueChanged += Slider_ValueChanged;

        sliderLabel.Text = "0";

Slider_ValueChanged method:

double selectedValue = 0d;

        private void Slider_ValueChanged(object sender, ValueChangedEventArgs e)
            double newStep = Math.Round(e.NewValue);

            slider.Value = newStep;

            if(selectedValue != newStep)
                selectedValue  = newStep;
                sliderLabel.Text = (newStep/2d).ToString();
Comment 1 Paul DiPietro [MSFT] 2017-11-30 20:25:42 UTC
I think I see what's being described and the issue seems to occur when it's at the top of the page, at least. Also tested with the latest 2.5.0 stable build, so I'll set this to confirmed for now until further investigation can be made.
Comment 2 Hakan 2017-12-01 04:50:14 UTC
I know the fix can take quite some time to make it into a release. Do you have a quick suggestion (e.g. a simple custom Label renderer solution etc.) for this that I can implement right away?