diff --git a/3-WPF命令.sln b/3-WPF命令.sln index 10d4f45..2441daa 100644 --- a/3-WPF命令.sln +++ b/3-WPF命令.sln @@ -10,6 +10,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "3-WPF命令4-微调命令 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "3-WPF命令5-直接调用命令", "3-WPF命令5-直接调用命令\3-WPF命令5-直接调用命令.csproj", "{5BCEFFC3-E3FE-4A32-BE43-EE5FF85DDFEB}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "3-WPF命令6-复制粘贴示例", "3-WPF命令6-复制粘贴示例\3-WPF命令6-复制粘贴示例.csproj", "{319276CC-0EE8-49C6-83FA-6217C95BAE15}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -36,5 +38,9 @@ Global {5BCEFFC3-E3FE-4A32-BE43-EE5FF85DDFEB}.Debug|Any CPU.Build.0 = Debug|Any CPU {5BCEFFC3-E3FE-4A32-BE43-EE5FF85DDFEB}.Release|Any CPU.ActiveCfg = Release|Any CPU {5BCEFFC3-E3FE-4A32-BE43-EE5FF85DDFEB}.Release|Any CPU.Build.0 = Release|Any CPU + {319276CC-0EE8-49C6-83FA-6217C95BAE15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {319276CC-0EE8-49C6-83FA-6217C95BAE15}.Debug|Any CPU.Build.0 = Debug|Any CPU + {319276CC-0EE8-49C6-83FA-6217C95BAE15}.Release|Any CPU.ActiveCfg = Release|Any CPU + {319276CC-0EE8-49C6-83FA-6217C95BAE15}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/3-WPF命令6-复制粘贴示例/3-WPF命令6-复制粘贴示例.csproj b/3-WPF命令6-复制粘贴示例/3-WPF命令6-复制粘贴示例.csproj new file mode 100644 index 0000000..2d1005d --- /dev/null +++ b/3-WPF命令6-复制粘贴示例/3-WPF命令6-复制粘贴示例.csproj @@ -0,0 +1,18 @@ + + + + WinExe + net8.0-windows + _3_WPF命令6_复制粘贴示例 + enable + enable + true + + + + + Always + + + + diff --git a/3-WPF命令6-复制粘贴示例/App.xaml b/3-WPF命令6-复制粘贴示例/App.xaml new file mode 100644 index 0000000..8a708a4 --- /dev/null +++ b/3-WPF命令6-复制粘贴示例/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/3-WPF命令6-复制粘贴示例/App.xaml.cs b/3-WPF命令6-复制粘贴示例/App.xaml.cs new file mode 100644 index 0000000..d8b3d5e --- /dev/null +++ b/3-WPF命令6-复制粘贴示例/App.xaml.cs @@ -0,0 +1,12 @@ +using System.Configuration; +using System.Data; +using System.Windows; + +namespace _3_WPF命令6_复制粘贴示例; + +/// +/// Interaction logic for App.xaml +/// +public partial class App : Application +{ +} \ No newline at end of file diff --git a/3-WPF命令6-复制粘贴示例/AssemblyInfo.cs b/3-WPF命令6-复制粘贴示例/AssemblyInfo.cs new file mode 100644 index 0000000..4a05c7d --- /dev/null +++ b/3-WPF命令6-复制粘贴示例/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] \ No newline at end of file diff --git a/3-WPF命令6-复制粘贴示例/MainWindow.xaml b/3-WPF命令6-复制粘贴示例/MainWindow.xaml new file mode 100644 index 0000000..a0fa7b7 --- /dev/null +++ b/3-WPF命令6-复制粘贴示例/MainWindow.xaml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3-WPF命令6-复制粘贴示例/MainWindow.xaml.cs b/3-WPF命令6-复制粘贴示例/MainWindow.xaml.cs new file mode 100644 index 0000000..d0b82c3 --- /dev/null +++ b/3-WPF命令6-复制粘贴示例/MainWindow.xaml.cs @@ -0,0 +1,44 @@ +using System.Windows; +using System.Windows.Input; + +namespace _3_WPF命令6_复制粘贴示例; + +/// +/// Interaction logic for MainWindow.xaml +/// +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; + } +} \ No newline at end of file diff --git a/3-WPF命令6-复制粘贴示例/public/003540AH4M72.jpg b/3-WPF命令6-复制粘贴示例/public/003540AH4M72.jpg new file mode 100644 index 0000000..4aa96ac Binary files /dev/null and b/3-WPF命令6-复制粘贴示例/public/003540AH4M72.jpg differ