Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我不知道这是否可能,但是我调用以下方法在 wpf 中显示一个窗口:
Window window = Window.Show();
窗口已经加载后,我想禁用窗口,即我不希望用户能够关闭窗口,直到满足某些条件......这可能吗?
我试过:
window.IsEnabled = false,这可行,但用户仍然可以关闭窗口...
window.IsEnabled = false
Closing如果不满足条件,则处理事件并取消:
Closing
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (/*condition not true*/) e.Cancel = true; }
但是,用户可以找到其他方法来关闭窗口,也许是关机?:)