xamarin/Xamarin.Forms

[Bug] Toggle label parent element visibility does not rerender properly

Aperta

#7486 aperta il 12 set 2019

 (1 commento) (0 reazioni) (0 assegnatari)C# (1926 fork)batch import
help wantedp/Androidp/iOS 🍎t/bug :bug:up-for-grabs

Metriche repository

Star
 (5644 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Description

With the following xaml setting the StackLayout visibility to true does not update the size of the Label. This is incorrect if the Label content was changed while the StackLayout was not visible.

     <StackLayout IsVisible="{Binding IsVisible}">
            <Label
                Text="{Binding Field}"
                HorizontalOptions="Start"
                BackgroundColor="Gold"
            />
        </StackLayout>

Steps to Reproduce

  1. Download the attached project
  2. Edit the entry content, and verify the label size is correctly updated
  3. Hide the label by clicking the toggle button
  4. Edit the entry content
  5. Show the label by clicking the toggle button, and see that the label size is invalid (possibly cutting off some words)
  6. Edit the entry content, and observe the label update.

Expected Behavior

When the label is set to visible, I expect the label to have the correct size.

Actual Behavior

The label is either too small or too big depending if content was added or removed.

Basic Information

  • Version with issue: 4.2.0.709249
  • Last known good version: None
  • IDE: VS2019
  • Platform Target Frameworks:
    • iOS: all tested versions
    • Android: all tested versions
    • UWP: not tested

Screenshots

screen1 screen2

Reproduction Link

LabelSize.zip

Guida contributor