From c9afba6819a12b4bfc56e14f87fffc7636676064 Mon Sep 17 00:00:00 2001
From: Bunny <1319900154@qq.com>
Date: Thu, 9 Jan 2025 10:47:44 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20WPF=E6=8E=A7=E4=BB=B6-15-ListBox2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
WPF控件-15-ListBox2/App.xaml | 9 +++++++
WPF控件-15-ListBox2/App.xaml.cs | 12 +++++++++
WPF控件-15-ListBox2/AssemblyInfo.cs | 10 +++++++
WPF控件-15-ListBox2/MainWindow.xaml | 14 ++++++++++
WPF控件-15-ListBox2/MainWindow.xaml.cs | 26 +++++++++++++++++++
.../WPF控件-15-ListBox2.csproj | 12 +++++++++
WPF控件.sln | 6 +++++
7 files changed, 89 insertions(+)
create mode 100644 WPF控件-15-ListBox2/App.xaml
create mode 100644 WPF控件-15-ListBox2/App.xaml.cs
create mode 100644 WPF控件-15-ListBox2/AssemblyInfo.cs
create mode 100644 WPF控件-15-ListBox2/MainWindow.xaml
create mode 100644 WPF控件-15-ListBox2/MainWindow.xaml.cs
create mode 100644 WPF控件-15-ListBox2/WPF控件-15-ListBox2.csproj
diff --git a/WPF控件-15-ListBox2/App.xaml b/WPF控件-15-ListBox2/App.xaml
new file mode 100644
index 0000000..10c577d
--- /dev/null
+++ b/WPF控件-15-ListBox2/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/WPF控件-15-ListBox2/App.xaml.cs b/WPF控件-15-ListBox2/App.xaml.cs
new file mode 100644
index 0000000..2333b0a
--- /dev/null
+++ b/WPF控件-15-ListBox2/App.xaml.cs
@@ -0,0 +1,12 @@
+using System.Configuration;
+using System.Data;
+using System.Windows;
+
+namespace WPF控件_15_ListBox2;
+
+///
+/// Interaction logic for App.xaml
+///
+public partial class App : Application
+{
+}
\ No newline at end of file
diff --git a/WPF控件-15-ListBox2/AssemblyInfo.cs b/WPF控件-15-ListBox2/AssemblyInfo.cs
new file mode 100644
index 0000000..4a05c7d
--- /dev/null
+++ b/WPF控件-15-ListBox2/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控件-15-ListBox2/MainWindow.xaml b/WPF控件-15-ListBox2/MainWindow.xaml
new file mode 100644
index 0000000..3b64f55
--- /dev/null
+++ b/WPF控件-15-ListBox2/MainWindow.xaml
@@ -0,0 +1,14 @@
+
+
+
+ 选项 1
+ 选项 2
+
+
+
\ No newline at end of file
diff --git a/WPF控件-15-ListBox2/MainWindow.xaml.cs b/WPF控件-15-ListBox2/MainWindow.xaml.cs
new file mode 100644
index 0000000..ae50b37
--- /dev/null
+++ b/WPF控件-15-ListBox2/MainWindow.xaml.cs
@@ -0,0 +1,26 @@
+using System.Windows;
+using System.Windows.Controls;
+
+namespace WPF控件_15_ListBox2;
+
+///
+/// Interaction logic for MainWindow.xaml
+///
+public partial class MainWindow : Window
+{
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+
+ private void ListBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ }
+
+ private void ListBox_OnClick(object sender, RoutedEventArgs e)
+ {
+ if (ListBox.SelectedItem == null) return;
+
+ Console.WriteLine($"已选中:{((CheckBox)ListBox.SelectedItem).IsChecked}");
+ }
+}
\ No newline at end of file
diff --git a/WPF控件-15-ListBox2/WPF控件-15-ListBox2.csproj b/WPF控件-15-ListBox2/WPF控件-15-ListBox2.csproj
new file mode 100644
index 0000000..cd80a4f
--- /dev/null
+++ b/WPF控件-15-ListBox2/WPF控件-15-ListBox2.csproj
@@ -0,0 +1,12 @@
+
+
+
+ WinExe
+ net8.0-windows
+ WPF控件_15_ListBox2
+ enable
+ enable
+ true
+
+
+
diff --git a/WPF控件.sln b/WPF控件.sln
index e2cb48c..a05b9a0 100644
--- a/WPF控件.sln
+++ b/WPF控件.sln
@@ -34,6 +34,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-14-PasswordBox",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-15-ListBox", "WPF控件-15-ListBox\WPF控件-15-ListBox.csproj", "{56F8A639-E31D-49E6-BBB7-77F74BBAF66D}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF控件-15-ListBox2", "WPF控件-15-ListBox2\WPF控件-15-ListBox2.csproj", "{169AB792-6D9D-4F12-A49A-320F01A0AFF0}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -108,5 +110,9 @@ Global
{56F8A639-E31D-49E6-BBB7-77F74BBAF66D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{56F8A639-E31D-49E6-BBB7-77F74BBAF66D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{56F8A639-E31D-49E6-BBB7-77F74BBAF66D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {169AB792-6D9D-4F12-A49A-320F01A0AFF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {169AB792-6D9D-4F12-A49A-320F01A0AFF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {169AB792-6D9D-4F12-A49A-320F01A0AFF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {169AB792-6D9D-4F12-A49A-320F01A0AFF0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal