<Window.TaskbarItemInfo>
<TaskbarItemInfo/>
</Window.TaskbarItemInfo>
just in front of the
<Grid>
. Now you can access TaskbarItemInfo
. This could be done like this:public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
TaskbarItemInfo.ProgressState = System.Windows.Shell.TaskbarItemProgressState.Normal;
Loaded += MainWindow_Loaded;
}
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
TaskbarItemInfo.ProgressValue = 0.5;
}
}
You can use different ProgressStates so the progress bar changes its color. You can also define a symbol for the task bar.
If you want to do all these things from another thread, this will not work. Why is explained in this post. I will only show the solution. Instead of
TaskbarItemInfo.ProgressValue = 0.2
you have to use
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
TaskbarItemInfo.ProgressValue = 0.2;
}));
No comments:
Post a Comment