dotnet / dotnet/wpf

Indeterminate progress bar used as BitmapCacheBrush target do not animate

Open
#8,960 5 comments 2 reactions 2 assignees Claimed by @h3xds1nz View on GitHub
:construction: work in progress Bug Investigate regression
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

When using a `BitmapCacheBrush` whose `Target` is a `ProgressBar` with `Indeterminate="True"`, the rendered control does not animate.

### Reproduction Steps

Create a new WPF project that targets either .NET 7 (`net7.0-windows`) or .NET 8 (`net8.0-windows`).

Add the following code to `MainWindow.xaml`:

```xaml









```

Run the application.

### Expected behavior

An animated, indeterminate progress bar should be rendered. This is the behavior on .NET 6.

![progress](https://github.com/dotnet/wpf/assets/68865158/6a5ec8c4-b0f9-4305-947c-8191f92836ec)

### Actual behavior

A static, completely filled progress bar is rendered:

![image](https://github.com/dotnet/wpf/assets/68865158/7a2ec0b9-5179-428b-be0a-ec9b4324f1ba)

### Regression?

This is a regression; it used to work in .NET 6.

### Known Workarounds

Instead of using a `BitmapCacheBrush`, you can use a `VisualBrush` and assign its `Visual` property to the progress bar (instead of the `BitmapCacheBrush.Target` property). This fixes the UI, but obviously is less ideal than using a `BitmapCacheBrush`.

### Impact

My application uses many progress bars that we synchronize and reduce their overhead with by using the bitmap cache. This bug breaks all of those bars.

### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.