Skip to content

Indeterminate progress bar used as BitmapCacheBrush target do not animate #8960

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

Open
mslukebo opened this issue Mar 26, 2024 · 4 comments · May be fixed by #10649
Open

Indeterminate progress bar used as BitmapCacheBrush target do not animate #8960

mslukebo opened this issue Mar 26, 2024 · 4 comments · May be fixed by #10649
Assignees
Labels
Bug Product bug (most likely) 🚧 work in progress Investigate Requires further investigation by the WPF team. regression status: This issue is a regression from a previous build or release

Comments

@mslukebo
Copy link

mslukebo commented Mar 26, 2024

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:

<Window x:Class="BlankWpf.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:BlankWpf"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Window.Resources>
        <ProgressBar x:Key="CachedProgressBar" Width="200" Height="10" IsIndeterminate="True" >
            <ProgressBar.CacheMode>
                <BitmapCache SnapsToDevicePixels="True" />
            </ProgressBar.CacheMode>
        </ProgressBar>

        <BitmapCacheBrush x:Key="CachedProgressBarBrush" Target="{StaticResource CachedProgressBar}" />
    </Window.Resources>

    <Grid>
        <Rectangle Fill="{StaticResource CachedProgressBarBrush}" Width="200" Height="10" />
    </Grid>
</Window>

Run the application.

Expected behavior

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

progress

Actual behavior

A static, completely filled progress bar is rendered:

image

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

@Kuldeep-MS Kuldeep-MS added the Investigate Requires further investigation by the WPF team. label Mar 27, 2024
@mslukebo
Copy link
Author

Update: I don't know what changed, but the VisualBrush workaround I shared stopped working, and the bug repros with that now. @Kuldeep-MS and @dipeshmsft can I get an update on this bug? There are now no workarounds to this issue.

@GSonofNun
Copy link

We just upgraded our application to .NET 8 from .NET 6 and now we have this problem too.
The difference for us is, we were using a second UI thread and a HostVisual to run the progress bar on a second thread, so long running tasks don't make it stutter. Would love for this to get fixed, or to have a workaround.

@trgibeau
Copy link

@dipeshmsft We are still running into issues, mind sharing an update on the bug?

@h3xds1nz
Copy link
Member

h3xds1nz commented Mar 25, 2025

The important part to note is that this repro's only for Aero2 or Fluent theme, not for Classic f.e.

So a second repro step is to add this into App.xaml. And that's why providing full projects is beneficial :)

<ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/PresentationFramework.Aero2;component/themes/Aero2.NormalColor.xaml"/>
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

@ThomasGoulet73 @dipeshmsft This was broken by #6266.

@h3xds1nz h3xds1nz added Bug Product bug (most likely) regression status: This issue is a regression from a previous build or release labels Mar 25, 2025
@h3xds1nz h3xds1nz self-assigned this Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Product bug (most likely) 🚧 work in progress Investigate Requires further investigation by the WPF team. regression status: This issue is a regression from a previous build or release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants