23 lines
568 B
C#
23 lines
568 B
C#
using System.Windows;
|
|
using System.Windows.Input;
|
|
|
|
namespace _3_WPF命令;
|
|
|
|
/// <summary>
|
|
/// Interaction logic for MainWindow.xaml
|
|
/// </summary>
|
|
public partial class MainWindow : Window
|
|
{
|
|
public MainWindow()
|
|
{
|
|
InitializeComponent();
|
|
var commandBinding = new CommandBinding(ApplicationCommands.New);
|
|
commandBinding.Executed += New_Executed;
|
|
CommandBindings.Add(commandBinding);
|
|
}
|
|
|
|
private void New_Executed(object sender, ExecutedRoutedEventArgs e)
|
|
{
|
|
MessageBox.Show("New command executed!");
|
|
}
|
|
} |