Skip to content

Image not always showing from ImageBrush; resetting screen scale makes it appear #7809

@JonPerkinsOldGit

Description

@JonPerkinsOldGit

Describe the bug

A simple ImageBrush control that is within a Rectangle.Fill, inside a GridView.Header doesn't always display the image.

I created my app using the latest template studio framework, and lifted the home page code from the latest WinUI 3 Gallery app. For reference to that app I am specifically talking about the top image which contains the orange ribbons, the "WinUI 3 Gallery" title text, and the "WinAppSDK 1.1" sub-header.

The crucial fragment of xaml is shown below, relevant code is at line 5:

        <GridView.Header>
            <Grid x:Name="HeaderGrid" Margin="12,39,43,50">
                <Rectangle Height="256" RadiusX="20" RadiusY="20" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                    <Rectangle.Fill>
                        <ImageBrush ImageSource="/Assets/OneDesktopSplash.jpg" Stretch="UniformToFill"/>
                    </Rectangle.Fill>
                </Rectangle>

                <TextBlock AutomationProperties.AutomationId="__ClickableAreaTextBlock" />
                <StackPanel Orientation="Vertical" Margin="50,80,0,20">
                    <TextBlock x:Name="smallHeaderText"
            Foreground="Black"
            Visibility="Visible"
            Style="{StaticResource TitleTextBlockStyle}"
            Text="xApp name goes here"/>
                    <TextBlock x:Name="smallHeaderSubtitleText"
            Foreground="Black"
            Visibility="Visible"
            Style="{StaticResource SubtitleTextBlockStyle}"
            Text="xVersion info goes here"/>

On about 70% of client computers they are seeing my version of the image that goes here - in my case "OneDesktopSplash.jpg". However, some clients do not have an image here at all so they just see the text. Needless to say this doesn't happen on any of my test computers but I did make a discovery today which has prompted me to raise this report in case somebody has enough information to make an educated guess. The client in question just purchased a new Win 11 computer so, via a remote desktop, I was also helping her with some of the general Settings parameters - fortunately I was doing this while my app was still open. She has a good resolution on her display - 3000 x 1920(?), with a Scale setting of 200%. There is quite a bit of content on my home page so I tried reducing the scale down to 175% - and the missing image appeared! When I set it back to 200% it was still there.

Is there a known issue of this type? I hate to waste your time but I couldn't see any references to this behaviour anywhere else.

Thank you.

Steps to reproduce the bug

As demonstrated by the code fragment. I cannot see any distinguishing factor as to when the image is shown and when it is not.

Expected behavior

Image should always be shown, there is no code in xaml or C# to make it invisible etc.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.1.5

Windows app type

  • UWP
  • Win32

Device form factor

Desktop

Windows version

Windows 11 (21H2): Build 22000

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions