Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. How to add text to richtextbox from different thread with wcf?

How to add text to richtextbox from different thread with wcf?

Scheduled Pinned Locked Moved WPF
csharpquestionwpfwcftutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Daniel Jansson
    wrote on last edited by
    #1

    I haven't found a solution for this yet, probably a lack of Google skills, but how can I update the contents in a richtextbox in wpf from a different thread? There is not Invoke or BeginInvoke on the control so delegates won't work? And using a delegate in this way: this.Dispatcher.Invoke(DispatcherPriority.Normal, new AddTextDelegate(_AppendtextLine), null, new object[] { text }); only makes the application hang. Any good ideas on this?

    S 1 Reply Last reply
    0
    • D Daniel Jansson

      I haven't found a solution for this yet, probably a lack of Google skills, but how can I update the contents in a richtextbox in wpf from a different thread? There is not Invoke or BeginInvoke on the control so delegates won't work? And using a delegate in this way: this.Dispatcher.Invoke(DispatcherPriority.Normal, new AddTextDelegate(_AppendtextLine), null, new object[] { text }); only makes the application hang. Any good ideas on this?

      S Offline
      S Offline
      schiebel t
      wrote on last edited by
      #2

      Hello Daniel, Check this out: http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx[BackgroundWorker] The BackgroundWorker enables you to stop the current Thread, and report the status. Hope this helps!

      D 1 Reply Last reply
      0
      • S schiebel t

        Hello Daniel, Check this out: http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx[BackgroundWorker] The BackgroundWorker enables you to stop the current Thread, and report the status. Hope this helps!

        D Offline
        D Offline
        Daniel Jansson
        wrote on last edited by
        #3

        Unfortunately, that won't help. Since i'm already on another thread when recieving the event, that's nothing I can control. The problem is access to the controls on the main thread when an event is recieved.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups