44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using System.Windows;
|
|
using System.Windows.Input;
|
|
|
|
namespace _3_WPF命令6_复制粘贴示例;
|
|
|
|
/// <summary>
|
|
/// Interaction logic for MainWindow.xaml
|
|
/// </summary>
|
|
public partial class MainWindow : Window
|
|
{
|
|
private const string NewText = "新建。。。";
|
|
private const string CopyText = "复制。。。";
|
|
private const string CutText = "剪切。。。";
|
|
private const string PastText = "粘贴。。。";
|
|
|
|
public MainWindow()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void CommandBinding_OnExecuted(object sender, ExecutedRoutedEventArgs e)
|
|
{
|
|
Console.WriteLine(NewText);
|
|
TestTextBox.Text += NewText;
|
|
}
|
|
|
|
private void CommandBindingCut_OnExecuted(object sender, ExecutedRoutedEventArgs e)
|
|
{
|
|
Console.WriteLine(CutText);
|
|
TestTextBox.Text += CutText;
|
|
}
|
|
|
|
private void CommandBindingCopy_OnExecuted(object sender, ExecutedRoutedEventArgs e)
|
|
{
|
|
Console.WriteLine(CopyText);
|
|
TestTextBox.Text += CopyText;
|
|
}
|
|
|
|
private void CommandBindingPast_OnExecuted(object sender, ExecutedRoutedEventArgs e)
|
|
{
|
|
Console.WriteLine(PastText);
|
|
TestTextBox.Text += PastText;
|
|
}
|
|
} |