xamarin/Xamarin.Forms

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

開放

#7,486 建立於 2019年9月12日

 (1 則留言) (0 個反應) (0 位負責人)C# (1,926 個分叉)batch import
help wantedp/Androidp/iOS 🍎t/bug :bug:up-for-grabs

倉庫指標

星標
 (5,644 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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

貢獻者指南