diff --git a/3-WPF命令.sln b/3-WPF命令.sln index d1f5d24..02b63e3 100644 --- a/3-WPF命令.sln +++ b/3-WPF命令.sln @@ -18,6 +18,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "4-WPF资源-1资源集合", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "4-WPF资源-3资源字典", "4-WPF资源-3资源字典\4-WPF资源-3资源字典.csproj", "{CB76C66A-B6F0-4CB3-AF3E-3DF9FE0D4FE3}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5-WPF样式和行为-1样式基础", "5-WPF样式和行为-1样式基础\5-WPF样式和行为-1样式基础.csproj", "{A8F279AB-332A-4EF6-B5A4-1F37A31A278A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -60,5 +62,9 @@ Global {CB76C66A-B6F0-4CB3-AF3E-3DF9FE0D4FE3}.Debug|Any CPU.Build.0 = Debug|Any CPU {CB76C66A-B6F0-4CB3-AF3E-3DF9FE0D4FE3}.Release|Any CPU.ActiveCfg = Release|Any CPU {CB76C66A-B6F0-4CB3-AF3E-3DF9FE0D4FE3}.Release|Any CPU.Build.0 = Release|Any CPU + {A8F279AB-332A-4EF6-B5A4-1F37A31A278A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A8F279AB-332A-4EF6-B5A4-1F37A31A278A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A8F279AB-332A-4EF6-B5A4-1F37A31A278A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A8F279AB-332A-4EF6-B5A4-1F37A31A278A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/5-WPF样式和行为-1样式基础/5-WPF样式和行为-1样式基础.csproj b/5-WPF样式和行为-1样式基础/5-WPF样式和行为-1样式基础.csproj new file mode 100644 index 0000000..26914c7 --- /dev/null +++ b/5-WPF样式和行为-1样式基础/5-WPF样式和行为-1样式基础.csproj @@ -0,0 +1,18 @@ + + + + WinExe + net8.0-windows + _5_WPF样式和行为_1样式基础 + enable + enable + true + + + + + Always + + + + diff --git a/5-WPF样式和行为-1样式基础/App.xaml b/5-WPF样式和行为-1样式基础/App.xaml new file mode 100644 index 0000000..954bf81 --- /dev/null +++ b/5-WPF样式和行为-1样式基础/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/5-WPF样式和行为-1样式基础/App.xaml.cs b/5-WPF样式和行为-1样式基础/App.xaml.cs new file mode 100644 index 0000000..9107e1e --- /dev/null +++ b/5-WPF样式和行为-1样式基础/App.xaml.cs @@ -0,0 +1,12 @@ +using System.Configuration; +using System.Data; +using System.Windows; + +namespace _5_WPF样式和行为_1样式基础; + +/// +/// Interaction logic for App.xaml +/// +public partial class App : Application +{ +} \ No newline at end of file diff --git a/5-WPF样式和行为-1样式基础/AssemblyInfo.cs b/5-WPF样式和行为-1样式基础/AssemblyInfo.cs new file mode 100644 index 0000000..4a05c7d --- /dev/null +++ b/5-WPF样式和行为-1样式基础/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/5-WPF样式和行为-1样式基础/MainWindow.xaml b/5-WPF样式和行为-1样式基础/MainWindow.xaml new file mode 100644 index 0000000..c26497d --- /dev/null +++ b/5-WPF样式和行为-1样式基础/MainWindow.xaml @@ -0,0 +1,31 @@ + + + 楷体 + 18 + Bold + + + + + + + + + + + \ No newline at end of file diff --git a/5-WPF样式和行为-1样式基础/MainWindow.xaml.cs b/5-WPF样式和行为-1样式基础/MainWindow.xaml.cs new file mode 100644 index 0000000..dc6bb6c --- /dev/null +++ b/5-WPF样式和行为-1样式基础/MainWindow.xaml.cs @@ -0,0 +1,23 @@ +using System.Windows; + +namespace _5_WPF样式和行为_1样式基础; + +/// +/// Interaction logic for MainWindow.xaml +/// +public partial class MainWindow : Window +{ + public MainWindow() + { + InitializeComponent(); + } + + private void MyButton_OnClick(object sender, RoutedEventArgs e) + { + var tryFindResource = (Style)BunnyButton.TryFindResource("BigFontButtonStyle"); + + Console.WriteLine(tryFindResource); + + if (tryFindResource != null) MyButton.Style = tryFindResource; + } +} \ No newline at end of file diff --git a/5-WPF样式和行为-1样式基础/public/003540AH4M72.jpg b/5-WPF样式和行为-1样式基础/public/003540AH4M72.jpg new file mode 100644 index 0000000..4aa96ac Binary files /dev/null and b/5-WPF样式和行为-1样式基础/public/003540AH4M72.jpg differ