ramesh kumar
ramesh kumar

Reputation: 24

Updating a element in WPF user control

I am having a user control and which has some elements along with a ellipse. When my main window in invoked and my user control is created i have a task that loops and does some task. During the execution of this task i need to update a element in the user control. I tried with the below code but it does not updates.

this.Dispatcher.Invoke((Action)(() =>
{

    ellipseRed.Visibility = System.Windows.Visibility.Visible;

}));

Upvotes: 0

Views: 79

Answers (1)

taquion
taquion

Reputation: 2767

Try using:

Application.Current.Dispatcher

This way you can update UI elements indirectly from another thread.

Upvotes: 1

Related Questions