How to Redraw or Refresh a screen

viky picture viky · Apr 8, 2010 · Viewed 13.2k times · Source

I am working on a wpf application. Here I need to use System.Windows.Forms.FolderBrowserDialog in my Wpf application.

        System.Windows.Forms.FolderBrowserDialog openFolderBrowser = new System.Windows.Forms.FolderBrowserDialog();

        openFolderBrowser.Description = "Select Resource Path:";
        openFolderBrowser.RootFolder = Environment.SpecialFolder.MyComputer;
        if (openFolderBrowser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
        {
            //some logic
            openFolderBrowser.Dispose();
        }

I launch a FolderBrowserDialog, select a Folder and click OK, and then I launch another System.Windows.Forms.FolderBrowserDialog, My problem is when I select a Folder and click OK in this FolderBrowserDialog, the shadow of FolderBrowserDialog remains on the screen(means my screen doesn't refresh). I need to minimize or resize it in order to remove the shadow of FolderBrowserDialog. How can I solve this issue? Any help plz?

Edit:

I found the solution. I called OnRender method on my wpf Window and it worked for me. It redraws everythign on the screen.

Answer

Anonymous picture Anonymous · Apr 8, 2010

You can call InvalidateVisual method to refresh UI.