【问题标题】:How to disable close button WPF? [duplicate]如何禁用关闭按钮 WPF? [复制]
【发布时间】:2017-07-10 20:31:57
【问题描述】:

如何禁用关闭按钮 WPF ?我不想隐藏,我只想禁用窗口的关闭按钮

是否有禁用关闭按钮的逻辑?

【问题讨论】:

标签: wpf xaml


【解决方案1】:

您可以编写事件代码,并在您关闭按钮时停止。 可能是我英语速度不太好,但你看代码还行。

    in wpf this event called Closing :
    public Window4()
    {
        InitializeComponent();
        this.Closing += new System.ComponentModel.CancelEventHandler(Window4_Closing);
    }
    void Window4_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    {
        e.Cancel = true;
    }

【讨论】:

  • 这不是禁用按钮。这只是导致它什么都不做。
猜你喜欢
  • 2013-04-14
  • 1970-01-01
  • 2014-03-09
  • 1970-01-01
  • 1970-01-01
  • 2011-09-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多