Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

wpf

grid

repaint

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 then, if that line is not right, I can adjust it -- but the previous line is still there. Now, the code I am writing sends information to the display based on what the user clicks. So this must mean that the display is not refreshed each time a new set of lines and boxes and text goes to the grid or canvas in WPF.

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

like image 365
xarzu Avatar asked May 22 '10 01:05

xarzu


People also ask

What is '~' in C language?

The tilde (~) is a character in the standard ASCII character set that is provided on a conventional computer keyboard and is used in both writing and computer programming. It corresponds to ASCII code 126. The tilde is also sometimes known as the twiddle.

What does the || mean in C?

The logical OR operator ( || ) returns the boolean value true if either or both operands is true and returns false otherwise.

What is operators in C?

C operators are one of the features in C which has symbols that can be used to perform mathematical, relational, bitwise, conditional, or logical manipulations. The C programming language has a lot of built-in operators to perform various tasks as per the need of the program.

What does -= mean in C++?

-= Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand. C -= A is equivalent to C = C - A.


1 Answers

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);
   }
}
like image 196
DevDemon Avatar answered Oct 01 '22 02:10

DevDemon