swinefish 5 Junior Poster in Training

Hey all

I'm having a problem with invoking methods through my dispatcher. Not all methods, just the one. Here's the problem code:

private delegate void oneArgDelegate(Chart arg);
...Do Work...
            c = new Chart();
            ....Set some properties....
            this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new oneArgDelegate(setGraph), c);

private void setGraph(Chart c)
        {
            GraphArea.Content = c;
            MessageBox.Show("Graph Set");
        }

I suspect that BeginInvoke() is not correctly passing the parameter to the method. The MessageBox Shown below the GraphArea.Content = c does not show - the program breaks before this. However, If a MessageBox is displayed before the GraphArea.Content = c, it does display. Any ideas on how to fix this?

Thanks in advance
M

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.