An Original Idea

because all great software begins with an original idea

Cross Thread User Interface updating in WPF

Posted by anoriginalidea on October 24, 2007

Recently I tried to update a WPF Dependency property from a System.Timer thread and received a ”Cross Threading” error.  This wasn’t entirely unexpected, as I’d encountered similar issues in Winforms in the past.

In Winforms, methods such as Invoke, BeginInvoke and InvokeRequired are used in order to force code to run on the UI thread.

The absence of these methods (but not the error message) in WPF was disconcerting.  Fortunately those methods (and many more) do exist, via an extra object called the “Dispatcher” object that hangs off all Ui Elements.  

image

Links

Forum Post – http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=328693&SiteID=1

WPF Threads: Build More Responsive Apps With The Dispatcher — MSDN Magazine, October 2007

One Response to “Cross Thread User Interface updating in WPF”

  1. NOINNYDIOLLEY said

    6354654 ,
    buy soma, buy tramadol online, buy lorazepam online, valium, fioricet online, hoodia weight loss, norco, tramadol ultram, ultracet, xenical,

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>