刷新wpf中的窗口 [英] Refresh a window in wpf
本文介绍了刷新wpf中的窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
请告诉我如何在一段时间后自动刷新wpf窗口。
谢谢
Hi all
Please tell me how to refresh a wpf window after a certain interval of time automatically.
Thank you
推荐答案
嗨Snehasish,
刷新是什么意思? WPF具有更新UI数据的绑定机制。对于非UI绑定对象,还有INotifyPropertyChanged:
Hi Snehasish,
What do you mean by refresh? WPF has binding mechanism for updating UI data. for non-UI binded object there is also the INotifyPropertyChanged:
// This method is called by the Set accessor of each property.
// The CallerMemberName attribute that is applied to the optional propertyName
// parameter causes the property name of the caller to be substituted as an argument.
private void NotifyPropertyChanged(String propertyName = "")
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
public event PropertyChangedEventHandler PropertyChanged;
但如果您的意思是如何带到WPF前窗,您可以使用以下代码:
But if you mean how to bring to front WPF window, you can use this code:
private void BringWindowToFront(Window window)
{
if (!window.IsVisible)
{
window.Show();
}
if (window.WindowState == WindowState.Minimized)
{
window.WindowState = WindowState.Normal;
}
window.Activate();
}
这篇关于刷新wpf中的窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文