So, I've decided to add a helper method to refresh a WPF control.
I really appreciated the Refresh method in Win Forms (which executes both Invalidate & Update), so I'm renaming my method to be Refresh as well.
Pretty weird; there was a post somewhere in my google search that led me this route, and I was surprised as to how it worked.
I couldn't find it anymore, but credit where credit is due, someone else figured out that Invoke-ing a Render or lower priority task will result in the UI being redrawn.
Since we don't want to do anything, I created an empty delegate. When the Dispatcher Priority is set to Render (or lower), the code will then execute all operations that are of that priority or higher. Content to something else, which will result in a render operation. Invoke, the code essentially asks the system to execute all operations that are Render or higher priority, thus the control will then render itself (drawing the new content).
Afterwards, it will then execute the provided delegate (which is our empty method).
Direct3D 10 and 11 both provide the Resolve Subresource method (Direct3D10. #region Example: Draw Overlay (after screenshot so we don't capture overlay as well) #region Draw fading lines based on last screencapture request if (_last Request Time ! = null) #endregion #region Draw frame rate using (Slim DX.
DWM) also uses the DXGI Present but haven’t looked into this in greater detail as the End Scene hook in Direct3D 9 achieves what we are after also. The D3D 9 example displays the frame rate and draws a box with a cross in the middle to identify the region that was captured – this fades after 1sec. The Refresh method is the extension method that takes any UI element and then calls that UIElement's Dispatcher's Invoke method.The trick is to call the Invoke method with Dispatcher Priority of Render or lower.Update (January 20, 2009): A Commenter asked for a full sample, so I've uploaded one here. helloim very happy to write to this mail to tell im a student and i love programming and i hope to learn more about w PF and im trying to use this code in but it doesnt work or im not able to do this can you help me with lesson or a code source in language to use refresh method and thanks u so much !!I don't speak Spanish, but Google translator was working great! @Mr K: Please leave an email next time; it's easier than corresponding via comments.