In C#, how do you send a refresh/repaint message to a WPF grid or canvas?

前端 未结 2 1662
孤街浪徒
孤街浪徒 2021-01-06 02:07

How do you send a refresh message to a WPF grid or canvas?

In other words, I have noticed while in debug mode, I can write code that sends a line to the display and

相关标签:
2条回答
  • 2021-01-06 02:51

    I'm used to winforms so this is only a guess, but look for an Invalidate() method.

    0 讨论(0)
  • 2021-01-06 03:05

    Refresh update WPF Controls like Winforms

    public static class ExtensionMethods
    {
       private static Action EmptyDelegate = delegate() { };
    
       public static void Refresh(this UIElement uiElement)
       {
          uiElement.Dispatcher.Invoke(DispatcherPriority.Render, EmptyDelegate);
       }
    }
    
    0 讨论(0)
提交回复
热议问题