From 1cb02af7d1d57ab6b7548a0502aa943566e472e7 Mon Sep 17 00:00:00 2001
From: Bunny <1319900154@qq.com>
Date: Wed, 8 Jan 2025 17:56:47 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20WPF=E6=8E=A7=E4=BB=B6-13-TextBox?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
WPF控件-13-TextBox/App.xaml | 9 ++++++
WPF控件-13-TextBox/App.xaml.cs | 12 +++++++
WPF控件-13-TextBox/AssemblyInfo.cs | 10 ++++++
WPF控件-13-TextBox/MainWindow.xaml | 15 +++++++++
WPF控件-13-TextBox/MainWindow.xaml.cs | 33 ++++++++++++++++++++
WPF控件-13-TextBox/WPF控件-13-TextBox.csproj | 12 +++++++
WPF控件.sln | 6 ++++
7 files changed, 97 insertions(+)
create mode 100644 WPF控件-13-TextBox/App.xaml
create mode 100644 WPF控件-13-TextBox/App.xaml.cs
create mode 100644 WPF控件-13-TextBox/AssemblyInfo.cs
create mode 100644 WPF控件-13-TextBox/MainWindow.xaml
create mode 100644 WPF控件-13-TextBox/MainWindow.xaml.cs
create mode 100644 WPF控件-13-TextBox/WPF控件-13-TextBox.csproj
diff --git a/WPF控件-13-TextBox/App.xaml b/WPF控件-13-TextBox/App.xaml
new file mode 100644
index 0000000..dbd04ce
--- /dev/null
+++ b/WPF控件-13-TextBox/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/WPF控件-13-TextBox/App.xaml.cs b/WPF控件-13-TextBox/App.xaml.cs
new file mode 100644
index 0000000..27ba1f9
--- /dev/null
+++ b/WPF控件-13-TextBox/App.xaml.cs
@@ -0,0 +1,12 @@
+using System.Configuration;
+using System.Data;
+using System.Windows;
+
+namespace WPF控件_13_TextBox;
+
+///
+/// Interaction logic for App.xaml
+///
+public partial class App : Application
+{
+}
\ No newline at end of file
diff --git a/WPF控件-13-TextBox/AssemblyInfo.cs b/WPF控件-13-TextBox/AssemblyInfo.cs
new file mode 100644
index 0000000..4a05c7d
--- /dev/null
+++ b/WPF控件-13-TextBox/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/WPF控件-13-TextBox/MainWindow.xaml b/WPF控件-13-TextBox/MainWindow.xaml
new file mode 100644
index 0000000..09d4630
--- /dev/null
+++ b/WPF控件-13-TextBox/MainWindow.xaml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WPF控件-13-TextBox/MainWindow.xaml.cs b/WPF控件-13-TextBox/MainWindow.xaml.cs
new file mode 100644
index 0000000..78fd586
--- /dev/null
+++ b/WPF控件-13-TextBox/MainWindow.xaml.cs
@@ -0,0 +1,33 @@
+using System.Windows;
+
+namespace WPF控件_13_TextBox;
+
+///
+/// Interaction logic for MainWindow.xaml
+///
+public partial class MainWindow : Window
+{
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+
+ private void TextBox_OnLoaded(object sender, RoutedEventArgs e)
+ {
+ TextBox.Text =
+ "TextWrapping=\"Wrap\" 是否换行 \n" +
+ " AcceptsReturn=\"True\" 收否回车键换行 \n" +
+ " AutoWordSelection=\"True\" 自动选择文本单词 \n " +
+ "IsUndoEnabled=\"False\" 是否开启Undo";
+ }
+
+ private void UndoButton_OnClick(object sender, RoutedEventArgs e)
+ {
+ var undo = TextBox.Undo();
+ Console.WriteLine($"undo:{undo}");
+
+ var textBoxCanUndo = TextBox.CanUndo;
+ var canUndo = $"TextBox can undo: {textBoxCanUndo}";
+ Console.WriteLine(canUndo);
+ }
+}
\ No newline at end of file
diff --git a/WPF控件-13-TextBox/WPF控件-13-TextBox.csproj b/WPF控件-13-TextBox/WPF控件-13-TextBox.csproj
new file mode 100644
index 0000000..c7693a5
--- /dev/null
+++ b/WPF控件-13-TextBox/WPF控件-13-TextBox.csproj
@@ -0,0 +1,12 @@
+
+
+
+ WinExe
+ net8.0-windows
+ WPF控件_13_TextBox
+ enable
+ enable
+ true
+
+
+
diff --git a/WPF控件.sln b/WPF控件.sln
index ee4841b..a502433 100644
--- a/WPF控件.sln
+++ b/WPF控件.sln
@@ -28,6 +28,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-11-Expander2", "W
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-12-多文本", "WPF控件-12-多文本\WPF控件-12-多文本.csproj", "{45A695BD-4B02-47F4-8598-144E882A8CF6}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-13-TextBox", "WPF控件-13-TextBox\WPF控件-13-TextBox.csproj", "{C53C3922-EB39-48E7-B88E-7552BDBE839D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -90,5 +92,9 @@ Global
{45A695BD-4B02-47F4-8598-144E882A8CF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45A695BD-4B02-47F4-8598-144E882A8CF6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45A695BD-4B02-47F4-8598-144E882A8CF6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C53C3922-EB39-48E7-B88E-7552BDBE839D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C53C3922-EB39-48E7-B88E-7552BDBE839D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C53C3922-EB39-48E7-B88E-7552BDBE839D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C53C3922-EB39-48E7-B88E-7552BDBE839D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal