Skip to content

Commit

Permalink
Fix BoxView not rendering when is hidden on start (#21960)
Browse files Browse the repository at this point in the history
* Update BoxView.cs

Added a sample to UITest

Update BoxView.cs

Update Issue19926.cs

* Updated screenshot
  • Loading branch information
kubaflo authored Dec 6, 2024
1 parent 7bfe434 commit 096ae74
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Controls/src/Core/BoxView/BoxView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ protected override void OnPropertyChanged([CallerMemberName] string? propertyNam

if (propertyName == BackgroundColorProperty.PropertyName ||
propertyName == ColorProperty.PropertyName ||
propertyName == IsVisibleProperty.PropertyName ||
propertyName == BackgroundProperty.PropertyName ||
propertyName == CornerRadiusProperty.PropertyName)
Handler?.UpdateValue(nameof(IShapeView.Shape));
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue19926.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,17 @@
<Label HorizontalTextAlignment="Center" Text="Scale X"/>
<BoxView ScaleX="1.5"/>
</StackLayout>

<StackLayout>
<Button
Text="Click to show a BoxView"
Clicked="Button_Clicked"
AutomationId="button"/>
<BoxView
x:Name="boxView"
AutomationId="boxView2"
HorizontalOptions="Center"
IsVisible="False"/>
</StackLayout>
</StackLayout>
</ContentPage>
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ public Issue19926()
{
InitializeComponent();
}

void Button_Clicked(object sender, System.EventArgs e)
{
boxView.IsVisible = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ public Issue19926(TestDevice device)

[Test]
[Category(UITestCategories.BoxView)]
public void PropertiesShouldBeCorrectlyApplied()
public async Task PropertiesShouldBeCorrectlyApplied()
{
_ = App.WaitForElement("boxView");
App.Click("button");
_ = App.WaitForElement("boxView2");

// A small delay to wait for the button ripple effect animation to complete.
await Task.Delay(500);
VerifyScreenshot();
}
}
Expand Down

0 comments on commit 096ae74

Please sign in to comment.