Here is the code that instantiate a window with an indeterminate progress bar, this code is called in a viewmdodel of some view :
Views.InstallingWindow installing = new Views.InstallingWindow(); installing.Show(); Application.Current.Dispatcher.Invoke(timeConsumingMethod, DispatcherPriority.Normal); installing.Close(); And here is the xaml of the window
<Window x:Class="Blabla.Views.InstallingWindow" 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:PatcherClient.Views" mc:Ignorable="d" Title="InstallingWindow" Height="150" Width="300" WindowStartupLocation="CenterScreen"> <Grid> <StackPanel Margin="10"> <ProgressBar Width="200" Height="20" Margin="10" Orientation="Horizontal" IsIndeterminate="True" /> <TextBlock HorizontalAlignment="Center" Name="StatusText" Margin="10" Height="50" Foreground="Black" Text="Installing ..."/> </StackPanel> </Grid> On my computer, the progress bar does not animate. How to fix it ?
BeginInvokeinstead.