This project has moved. For the latest updates, please go here.

How to set BusyIndicator template in window resource?

Feb 20, 2013 at 3:41 PM
Edited Feb 20, 2013 at 3:42 PM
I am trying to create BusyIndicator dynamically in my application from code behind.
I managed sofar to create and show BusyIndicator from code behind using the code below.
But, I want to have puase and cancel button on the BusyIndicator like the "Custom Content" example. How can I define the data template in either window.resource or in app page?
            BusyIndicator B = new BusyIndicator();
            B.Visibility = Visibility.Visible;
            B.Width = 200;
            B.Height = 80;
            //B.Style = this.FindResource("Busy_Style") as Style;   <<<=== This style should be set in window resource
            worker = new BackgroundWorker();
            worker.DoWork += (o, ea) =>
                ..... calculations
            worker.RunWorkerCompleted += (o, ea) =>
                B.IsBusy = false;

            B.IsBusy = true;