Wpf Extended toolkit BusyIndicator not showing during operation

自闭症网瘾萝莉.ら 提交于 2019-12-02 09:46:14

Your "background" code isn't background at all. There must be something like this:

private void CboItemId_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    // turn indicator ON
    ItemSearchBusyIndicator.IsBusy = true;

    var _backgroundWorker = new BackgroundWorker();
    _backgroundWorker.DoWork += backgroundWorker_DoWork;
    _backgroundWorker.RunWorkerCompleted += _backgroundWorker_RunWorkerCompleted;

    // start background operation;
    // direct call to backgroundWorker_DoWork just calls method synchronously
    _backgroundWorker.RunWorkerAsync();
}

private void _backgroundWorker_RunWorkerCompleted(/* I don't remember signature */)
{
    // turn indicator OFF
    ItemSearchBusyIndicator.IsBusy = false;

    // other code
}

Also, note, that BackgroundWorker is rather obsolete API. Consider TPL (and, optionally, async/await) instead.

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