我正在嘗試將 WPF 命令用于簡單的用戶界面。我的大多數命令系結都很好,但我不知道如何在 SystemCommands 類中使用它們。在我的 XAML 中,我有:
<Window.CommandBindings>
<CommandBinding Command="ApplicationCommands.New" CanExecute="NewCommandCanExecute" Executed="NewCommandExecuted"/>
<CommandBinding Command="ApplicationCommands.Open" CanExecute="OpenCommandCanExecute" Executed="OpenCommandExecuted"/>
<CommandBinding Command="ApplicationCommands.Save" CanExecute="SaveCommandCanExecute" Executed="SaveCommandExecuted"/>
<CommandBinding Command="SystemCommands.CloseWindow" CanExecute="CloseWindowCanExecute" Executed="CloseWindowExecuted"/>
</Window.CommandBindings>
ApplicationCommands 中的那些完全按預期作業,但SystemCommand.CloseWIndow給出了錯誤“成員“CloseWindow”無法識別或無法訪問。
我錯過了什么?
uj5u.com熱心網友回復:
該RoutedCommand屬性稱為 CloseWindow命令:
<CommandBinding Command="SystemCommands.CloseWindowCommand" .../>
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/357667.html
