Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I refresh window in wpf?

Tags:

c#

wpf

datagrid

I have a small project I am working on which is a window with 4 WPF tabs on it.

The first tab is where I do most of the work, but occasionally I need to move back to other tabs. One of these tabs has a DataGrid that is bound to a list that is affected by the main tab I stay on.

When I update something on the first tab, I need it to cause a refresh on the data in the Datagrid(usually just to update a value).

The only way it has been working is if I click on the header myself.

How can I do this in code?

Thanks

like image 403
TheJediCowboy Avatar asked Feb 06 '11 22:02

TheJediCowboy


1 Answers

I used this workaround, it's no perfect but works

MainWindow newWindow = new MainWindow();
Application.Current.MainWindow = newWindow;
newWindow.Show();
this.Close();
like image 196
Antonio Reyes Avatar answered Sep 17 '22 15:09

Antonio Reyes