Busy indicator not showing up in wpf window [dupli

2019-07-11 06:09发布

Possible Duplicate:
wpf busyindicator not showing up

I am tryihng to use busy indicator in a window like this:

   <extToolkit:BusyIndicator Width="160" Height="100"
               x:Name="busyIndicator" Visibility="Hidden"  />

I am trying to call this when the user chooses some files to import and then im doing some parsing on those files.

And setting these two properties:

importProgressBar.busyIndicator.IsBusy = true;
importProgressBar.busyIndicator.Visibility = Visibility.Visible;

before the window pops up.

I am calling a delegate function whenever a file parsing is finished. And inside that I'm calling the window with the busy indicator.

private void ShowIndicator(ProgressReport progressReport)
{
    window.Show();

    if (progressReport.OverallProgress.Completed)
    {
        window.Close();
    }
}

So as you can see inside this function I have property completed which on complete will close the window automatically but the window shows up with no busy indicator.

Can someone point out why busy indicator is not showing in window?

1条回答
劳资没心,怎么记你
2楼-- · 2019-07-11 06:45

use:

Dispatcher.Invoke(DispatcherPriority.Background,
new Action(() => { Window.Show() }));
查看更多
登录 后发表回答