Communication between Multiple Threads in a WPF Application
        Posted  
        
            by Robert
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Robert
        
        
        
        Published on 2010-05-30T01:12:06Z
        Indexed on 
            2010/05/30
            9:02 UTC
        
        
        Read the original article
        Hit count: 227
        
I'm creating a WPF application that uses a custom object to populate all the controls. The constructor of that object is initiated by an EventHandler that waits for an API. The problem I'm having is when I try to access any information from that object using a button for example, it returns an error saying "The calling thread cannot access this object because a different thread owns it". I'm assuming this is because the EventHandler creates a new thread which doesn't allow the Main Thread to have access to it. Any ideas on how to get around this?
I'm basically having the error "The calling thread cannot access this object because a different thread owns it" when trying to get or set a CollectionViewSource.
© Stack Overflow or respective owner