Why won't my progress bar work?

Posted by user113164 on Stack Overflow See other posts from Stack Overflow or by user113164
Published on 2009-07-13T19:30:04Z Indexed on 2010/04/04 0:33 UTC
Read the original article Hit count: 845

Filed under:
|
|

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();
    }
}

© Stack Overflow or respective owner

Related posts about wpf

Related posts about c#