Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Updating a Label content from code behind using dispatcher

$
0
0

hi,

I am trying to update a label's content from code behind.

This part of the code is running in background worker. I wrote the following code to update a label's content:

volumecontrol.Dispatcher.BeginInvoke(new Action(() =>
                        {
                            volumecontrol.Content = volumeupdate;
                        }));

 i tried using both BeginInvoke and Invoke but the application exits with the error:

System.InvalidOperationException' occurred in WindowsBase.dll

Using Invoke works when updating the UI from another thread but it not working in this case:

Pls help.

Thanks,

Shaleen


TheHexLord


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>