diff --git a/WPF控件.sln b/WPF控件.sln index 1162007..920fe32 100644 --- a/WPF控件.sln +++ b/WPF控件.sln @@ -50,6 +50,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF绑定元素-1-代码模 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF绑定元素-2-代码检索绑定", "WPF绑定元素-2-代码检索绑定\WPF绑定元素-2-代码检索绑定.csproj", "{5797E06A-32B3-4F16-BC46-D88C8E5A5F48}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPF绑定元素-2-多绑定", "WPF绑定元素-2-多绑定\WPF绑定元素-2-多绑定.csproj", "{610A264F-5995-4667-8FD9-3494481928FF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -156,5 +158,9 @@ Global {5797E06A-32B3-4F16-BC46-D88C8E5A5F48}.Debug|Any CPU.Build.0 = Debug|Any CPU {5797E06A-32B3-4F16-BC46-D88C8E5A5F48}.Release|Any CPU.ActiveCfg = Release|Any CPU {5797E06A-32B3-4F16-BC46-D88C8E5A5F48}.Release|Any CPU.Build.0 = Release|Any CPU + {610A264F-5995-4667-8FD9-3494481928FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {610A264F-5995-4667-8FD9-3494481928FF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {610A264F-5995-4667-8FD9-3494481928FF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {610A264F-5995-4667-8FD9-3494481928FF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/WPF绑定元素-2-多绑定/App.xaml b/WPF绑定元素-2-多绑定/App.xaml new file mode 100644 index 0000000..f8d3c6b --- /dev/null +++ b/WPF绑定元素-2-多绑定/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/WPF绑定元素-2-多绑定/App.xaml.cs b/WPF绑定元素-2-多绑定/App.xaml.cs new file mode 100644 index 0000000..c93584f --- /dev/null +++ b/WPF绑定元素-2-多绑定/App.xaml.cs @@ -0,0 +1,12 @@ +using System.Configuration; +using System.Data; +using System.Windows; + +namespace WPF绑定元素_2_多绑定; + +/// +/// Interaction logic for App.xaml +/// +public partial class App : Application +{ +} \ No newline at end of file diff --git a/WPF绑定元素-2-多绑定/AssemblyInfo.cs b/WPF绑定元素-2-多绑定/AssemblyInfo.cs new file mode 100644 index 0000000..4a05c7d --- /dev/null +++ b/WPF绑定元素-2-多绑定/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绑定元素-2-多绑定/MainWindow.xaml b/WPF绑定元素-2-多绑定/MainWindow.xaml new file mode 100644 index 0000000..5dddd1b --- /dev/null +++ b/WPF绑定元素-2-多绑定/MainWindow.xaml @@ -0,0 +1,34 @@ + + + + + + 这是文字内容 + + + Pink + Red + Green + + + + + + + + + + \ No newline at end of file diff --git a/WPF绑定元素-2-多绑定/MainWindow.xaml.cs b/WPF绑定元素-2-多绑定/MainWindow.xaml.cs new file mode 100644 index 0000000..4eab217 --- /dev/null +++ b/WPF绑定元素-2-多绑定/MainWindow.xaml.cs @@ -0,0 +1,26 @@ +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; + +namespace WPF绑定元素_2_多绑定; + +/// +/// Interaction logic for MainWindow.xaml +/// +public partial class MainWindow : Window +{ + public MainWindow() + { + InitializeComponent(); + + // 创建一个 Binding 对象 + var binding = new Binding("Value") + { + Source = TextBlockSlider, + Delay = 500 // 设置延迟时间 + }; + + // 将 Binding 应用到 TextBox 的 Text 属性上 + ExactSizeForSlider.SetBinding(TextBox.TextProperty, binding); + } +} \ No newline at end of file diff --git a/WPF绑定元素-2-多绑定/WPF绑定元素-2-多绑定.csproj b/WPF绑定元素-2-多绑定/WPF绑定元素-2-多绑定.csproj new file mode 100644 index 0000000..880ca67 --- /dev/null +++ b/WPF绑定元素-2-多绑定/WPF绑定元素-2-多绑定.csproj @@ -0,0 +1,12 @@ + + + + WinExe + net8.0-windows + WPF绑定元素_2_多绑定 + enable + enable + true + + +