如何在 wpf 中刷新页面或窗口?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19270371/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to refresh a page or window in wpf?
提问by user2631662
I cannot seem to refresh or reload a parent window or page in wpf. I have tried the following:
我似乎无法在 wpf 中刷新或重新加载父窗口或页面。我尝试了以下方法:
private void btClear1_Click(object sender, RoutedEventArgs e)
{
//this.LayoutUpdate();
//Refresh();
//this.NavigationService.Refresh();
}
回答by Pavel Tupitsyn
You can achieve complete layout/render pass with InvalidateVisual call (http://msdn.microsoft.com/en-us/library/system.windows.uielement.invalidatevisual.aspx)
您可以通过 InvalidateVisual 调用(http://msdn.microsoft.com/en-us/library/system.windows.uielement.invalidatevisual.aspx)实现完整的布局/渲染过程

