UI update in WPF elements event handlers

前端 未结 2 1626
萌比男神i
萌比男神i 2021-01-02 12:53

There is a problem with UI update in WPF.

I have such code:

    private void ButtonClick_EventHandler(object sender, RoutedEventArgs e)
    {
                


        
2条回答
  •  一生所求
    2021-01-02 13:31

    Visibility and Text are dependency properties which updated by dispatcher. Your solution is absolutely corrent, but my suggestion is to do it asynchronously.

    On other hand, you might simulate Application.DoEvents in WPF (see the article).

提交回复
热议问题