Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] BoxView loses background color when its parent is removed and re-added to the container #3214

Closed
alexeystrakh opened this issue Nov 1, 2021 · 9 comments
Assignees
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter partner/winui WinUI / Project Reunion partner Issue or Request from a partner team s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)
Projects

Comments

@alexeystrakh
Copy link

alexeystrakh commented Nov 1, 2021

Description

BoxView loses background color when its parent is removed and re-added to the container. Rearrange is added in order to change the control's (target) z-index to move on top of other items.

Steps to Reproduce

  1. Create an AbsoluteLayout, Grid inside with BoxView
  2. Remove and re-add the Grid from/to AbosoluteLayout container

Expected Behavior

BoxView keeps the background color

Actual Behavior

BoxView has no background after the step 2

Basic Information

  • Version with issue: 6.0.100-rc.2.21505.57
  • Last known good version: NA
  • IDE: VS2022 - Preview 5
  • Platform Target Frameworks: iOS, Android, Windows

Screenshots

the target in its original state:
image

the target after being removed and readded to the container
image

Reproduction Link

<Grid x:Name="target">
    <BoxView BackgroundColor="Red" WidthRequest="50" HeightRequest="50" />
</Grid>

var targetContainer = target.Parent as Layout;
targetContainer.Children.Remove(target);
targetContainer.Children.Add(target);

Workaround

None is found

@alexeystrakh alexeystrakh added the t/bug Something isn't working label Nov 1, 2021
@github-actions github-actions bot added the partner Issue or Request from a partner team label Nov 1, 2021
@hartez
Copy link
Contributor

hartez commented Nov 2, 2021

@alexeystrakh Do you have the same issue if you use a Rectangle?

@alexeystrakh
Copy link
Author

I have reproduced this issue after adding a few more controls to the layout, the underlying issue is not with the color but with the Grid layout which is not properly resized after the control is being added back to the layout in runtime.

@hartez
Copy link
Contributor

hartez commented Nov 4, 2021

@alexeystrakh How are you positioning the Grid inside the AbsoluteLayout?

@hartez
Copy link
Contributor

hartez commented Nov 4, 2021

@alexeystrakh I'm attaching my effort at reproducing this - can you take a look and tell me what I'm missing? Removing and re-adding the Grid, it seems to be sized fine and contain the expected BoxViews.

ReparentRepro.zip

@jsuarezruiz jsuarezruiz added the s/needs-info Issue needs more info from the author label Nov 5, 2021
@jsuarezruiz jsuarezruiz added this to New in Triage via automation Nov 5, 2021
@jsuarezruiz jsuarezruiz moved this from New to Needs Info in Triage Nov 5, 2021
@mattleibow mattleibow added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label Nov 5, 2021
@hartez
Copy link
Contributor

hartez commented Nov 6, 2021

This is not limited to BoxView - any Shape we remove and re-add has this issue.

@jsuarezruiz
Copy link
Contributor

@hartez I can't reproduce it in main branch, could you attach an example or share more details?. Thanks!

@hartez hartez added legacy-area-desktop Windows / WinUI / Project Reunion & Mac Catalyst / macOS specifics (Menus & other Controls)) partner/winui WinUI / Project Reunion and removed s/needs-info Issue needs more info from the author labels Nov 9, 2021
@hartez
Copy link
Contributor

hartez commented Nov 9, 2021

The repro project above will demonstrate it if you run it on Windows.
The cause is microsoft/microsoft-ui-xaml#1900
dotnet/Microsoft.Maui.Graphics#229 will work around the issue for the W2DGraphicsView, which solves it for Shapes in MAUI.

@hartez hartez self-assigned this Nov 9, 2021
@hartez
Copy link
Contributor

hartez commented Nov 13, 2021

Fix is merged in MAUI.Graphics - once we get the new version pulled into MAUI we can test again and possibly close this.

@kristinx0211 kristinx0211 added the s/verified Verified / Reproducible Issue ready for Engineering Triage label Feb 22, 2022
@kristinx0211
Copy link

Not reproducible with windows 10.0.19041.

Triage automation moved this from Needs Info to Done Feb 22, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Mar 24, 2022
@Eilon Eilon added t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK) and removed legacy-area-desktop Windows / WinUI / Project Reunion & Mac Catalyst / macOS specifics (Menus & other Controls)) labels May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter partner/winui WinUI / Project Reunion partner Issue or Request from a partner team s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)
Projects
No open projects
Development

No branches or pull requests

6 participants