Busy indicator not showing up in wpf window [duplicate]

倾然丶 夕夏残阳落幕 提交于 2019-12-10 22:19:54

问题


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:


use:

Dispatcher.Invoke(DispatcherPriority.Background,
new Action(() => { Window.Show() }));


来源:https://stackoverflow.com/questions/6296319/busy-indicator-not-showing-up-in-wpf-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!