microsoft / microsoft/microsoft-ui-xaml

Border with ImageBrush no longer shows after setting Opacity to 1 with initial value 0

Open
#10,760 0 comments 0 reactions 0 assignees View on GitHub
area-Images bug team-Rendering
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

If I have a `Border` painted with `ImageBrush`
```xml





```
It no longer shows after I set its `Opacity` to `1` in code-behind
```cpp
MyImage().Opacity(1);
```

If you give `Opacity` an initial value to something non-zero, like `0.5`, it behaves as expected.
### Why is this important?

This is blocking my project

### Steps to reproduce the bug

1. Create a winui3 C++ project
2. In `MainWindow.xaml`
```xml






Opacity set

```
3. In code-behind
```cpp
void winrt::WinUI3Cpp::implementation::MainWindow::Button_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e)
{
MyImage().Opacity(1);
}
```
4. Run project, click the button, the image is not shown

### Actual behavior

_No response_

### Expected behavior

The image should show after setting its opacity to non-zero

### Screenshots

_No response_

### NuGet package version

WinUI 3 - Windows App SDK 1.7.3: 1.7.250606001

### Windows version

Windows 11 (23H2): Build 22631

### Additional context
This issue does NOT happen with a regular `Image` control

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue using MainWindow.xaml and the Button_Click code-behind entry point, starting with the Border/ImageBrush case described in the report. Compare it with the regular Image control behavior; done means the image renders after Opacity changes from its initial value of 0 to 1.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.