maui icon indicating copy to clipboard operation
maui copied to clipboard

Setting InputTransparent=true on a layout will remove the background

Open mattleibow opened this issue 2 years ago • 3 comments

Description

I would expect this to appear as a Green box with a button, instead it is a red box with a button - the green background is gone.

    <Grid x:Name="rootLayout" InputTransparent="False" Background="Red">
        <Grid x:Name="nestedLayout" InputTransparent="True" Background="Green">
            <Button x:Name="testButton" Text="Test Button" Clicked="ClickSuccess" HorizontalOptions="Center" VerticalOptions="Center" InputTransparent="False" />
        </Grid>
    </Grid>

To get the background that is input transparent, we add a canvas to the layout - except that we can remove this at any time. The LayoutHandler for Windows just adds and removes children based on index, yet the background is at index 0.

Steps to Reproduce

  1. File | New | Maui App
  2. Copy the XAML
  3. Run
  4. Observe the red background

Link to public reproduction project repository

N/A

Version with bug

8.0.0-rc.1.9171

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

mattleibow avatar Sep 15 '23 01:09 mattleibow

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

ghost avatar Sep 18 '23 14:09 ghost

Right now, the Layout is handing this case of a background, but probably for layouts we should use a wrapper view and put the background in there instead. This makes the layout handler code far simpler. The wrapper view can be the part that adds a canvas and manages that.

mattleibow avatar Sep 18 '23 16:09 mattleibow

Verified this on Visual Studio Enterprise 17.9.0 Preview 1(8.0.3). Repro on Windows 11, not repro on Android 14.0-API34, iOS 17.0 and MacCatalyst with below Project: 17389.zip

image

XamlTest avatar Dec 06 '23 08:12 XamlTest