Why won't my progress bar work?
- by user113164
I can't get my progress bar to work. Any help is much appreciated!
Here's the code:
<Window x:Class="BulkSAConfigureControl.BulkSaProgressBar"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Please Wait.." Height="60" Width="300" WindowStyle="ToolWindow" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<ProgressBar Name="progressBar" IsIndeterminate="True">
<ProgressBar.Resources>
<ResourceDictionary Source="/PresentationFramework.Aero;v3.0.0.0;31bf3856ad364e35;component/themes/aero.normalcolor.xaml" />
</ProgressBar.Resources>
</ProgressBar>
.
public class ProgressBarClass : Window
{
public ProgressBarClass()
{
InitializeComponent();
}
public void StartProgressBar()
{
Duration d = new Duration(TimeSpan.FromSeconds(5));
DoubleAnimation anim = new DoubleAnimation(100.0, d);
progressBar.BeginAnimation(ProgressBar.ValueProperty, anim);
this.Show();
}
public void StopProgressBar()
{
this.Close();
}
}
.
public class DoSomething : UserControl
{
public void DoSomeStuff()
{
ProgressBarClass pBar = new ProgressBarClass();
pBar.StartProgressBar();
// Do some stuff here
pBar.StopProgressBar();
}
}