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 合并指标
 (30 天内没有已合并 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

贡献者指南