WPF update binding in a background thread

后端 未结 5 1470
情话喂你
情话喂你 2020-12-25 07:52

I have a control that has its data bound to a standard ObservableCollection, and I have a background task that calls a service to get more data.

I want

5条回答
  •  自闭症患者
    2020-12-25 08:22

    Use this:

    
    Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Render, new Action(UpdateData), value);
    
    private void UpdateData(int value)
    {
      BindingSourceProperty = value;
    }
    
    
    

提交回复
热议问题