{"id":45028,"date":"2025-06-22T02:22:49","date_gmt":"2025-06-21T18:22:49","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/45028.html"},"modified":"2025-06-22T02:22:49","modified_gmt":"2025-06-21T18:22:49","slug":"c-wpf%e7%a8%8b%e5%ba%8f%e7%95%8c%e9%9d%a2%e7%be%8e%e5%8c%96%e6%96%b9%e6%b3%95%e4%b8%8e%e8%af%a6%e7%bb%86%e6%ad%a5%e9%aa%a4","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/45028.html","title":{"rendered":"C# WPF\u7a0b\u5e8f\u754c\u9762\u7f8e\u5316\u65b9\u6cd5\u4e0e\u8be6\u7ec6\u6b65\u9aa4"},"content":{"rendered":"<p>WPF\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u754c\u9762\u7f8e\u5316\u80fd\u529b&#xff0c;\u4e0b\u9762\u6211\u5c06\u4ecb\u7ecd\u591a\u79cdWPF\u754c\u9762\u7f8e\u5316\u7684\u65b9\u6cd5\u53ca\u8be6\u7ec6\u5b9e\u73b0\u6b65\u9aa4\u3002<\/p>\n<p>\u4e00\u3001\u57fa\u7840\u7f8e\u5316\u65b9\u6cd5 1. \u4f7f\u7528\u6837\u5f0f(Style) \u6b65\u9aa4&#xff1a;<\/p>\n<p>\u5728App.xaml\u6216\u8d44\u6e90\u5b57\u5178\u4e2d\u5b9a\u4e49\u6837\u5f0f<\/p>\n<p>&lt;Application.Resources&gt;<br \/>\n    &lt;Style x:Key&#061;&#034;MyButtonStyle&#034; TargetType&#061;&#034;Button&#034;&gt;<br \/>\n        &lt;Setter Property&#061;&#034;Background&#034; Value&#061;&#034;#FF4CAF50&#034;\/&gt;<br \/>\n        &lt;Setter Property&#061;&#034;Foreground&#034; Value&#061;&#034;White&#034;\/&gt;<br \/>\n        &lt;Setter Property&#061;&#034;FontSize&#034; Value&#061;&#034;14&#034;\/&gt;<br \/>\n        &lt;Setter Property&#061;&#034;Padding&#034; Value&#061;&#034;10 5&#034;\/&gt;<br \/>\n        &lt;Setter Property&#061;&#034;Template&#034;&gt;<br \/>\n            &lt;Setter.Value&gt;<br \/>\n                &lt;ControlTemplate TargetType&#061;&#034;Button&#034;&gt;<br \/>\n                    &lt;Border Background&#061;&#034;{TemplateBinding Background}&#034;<br \/>\n                            CornerRadius&#061;&#034;4&#034;&gt;<br \/>\n                        &lt;ContentPresenter HorizontalAlignment&#061;&#034;Center&#034;<br \/>\n                                          VerticalAlignment&#061;&#034;Center&#034;\/&gt;<br \/>\n                    &lt;\/Border&gt;<br \/>\n                &lt;\/ControlTemplate&gt;<br \/>\n            &lt;\/Setter.Value&gt;<br \/>\n        &lt;\/Setter&gt;<br \/>\n    &lt;\/Style&gt;<br \/>\n&lt;\/Application.Resources&gt; <\/p>\n<p>\u5728\u63a7\u4ef6\u4e0a\u5e94\u7528\u6837\u5f0f<\/p>\n<p>&lt;Button Style&#061;&#034;{StaticResource MyButtonStyle}&#034; Content&#061;&#034;Click Me&#034;\/&gt; <\/p>\n<p>2. \u4f7f\u7528\u63a7\u4ef6\u6a21\u677f(ControlTemplate) \u6b65\u9aa4&#xff1a;<\/p>\n<p>\u5b9a\u4e49\u63a7\u4ef6\u6a21\u677f<\/p>\n<p>&lt;ControlTemplate x:Key&#061;&#034;RoundButtonTemplate&#034; TargetType&#061;&#034;Button&#034;&gt;<br \/>\n    &lt;Grid&gt;<br \/>\n        &lt;Ellipse Fill&#061;&#034;{TemplateBinding Background}&#034; Stroke&#061;&#034;{TemplateBinding BorderBrush}&#034;\/&gt;<br \/>\n        &lt;ContentPresenter HorizontalAlignment&#061;&#034;Center&#034; VerticalAlignment&#061;&#034;Center&#034;\/&gt;<br \/>\n    &lt;\/Grid&gt;<br \/>\n&lt;\/ControlTemplate&gt; <\/p>\n<p>\u5e94\u7528\u6a21\u677f<\/p>\n<p>&lt;Button Template&#061;&#034;{StaticResource RoundButtonTemplate}&#034;<br \/>\n        Background&#061;&#034;Blue&#034;<br \/>\n        Content&#061;&#034;\u5706\u5f62\u6309\u94ae&#034;\/&gt; <\/p>\n<p>\u4e8c\u3001\u9ad8\u7ea7\u7f8e\u5316\u6280\u672f 1. \u4f7f\u7528\u4e3b\u9898(Themes) \u6b65\u9aa4&#xff1a;<\/p>\n<p>\u6dfb\u52a0MahApps.Metro\u7b49\u4e3b\u9898\u5e93<\/p>\n<p>\u901a\u8fc7NuGet\u5b89\u88c5&#xff1a;Install-Package MahApps.Metro<\/p>\n<p>\u5728App.xaml\u4e2d\u5f15\u7528\u4e3b\u9898<\/p>\n<p>&lt;Application.Resources&gt;<br \/>\n    &lt;ResourceDictionary&gt;<br \/>\n        &lt;ResourceDictionary.MergedDictionaries&gt;<br \/>\n            &lt;ResourceDictionary Source&#061;&#034;pack:\/\/application:,,,\/MahApps.Metro;component\/Styles\/Controls.xaml&#034; \/&gt;<br \/>\n            &lt;ResourceDictionary Source&#061;&#034;pack:\/\/application:,,,\/MahApps.Metro;component\/Styles\/Fonts.xaml&#034; \/&gt;<br \/>\n            &lt;ResourceDictionary Source&#061;&#034;pack:\/\/application:,,,\/MahApps.Metro;component\/Styles\/Colors.xaml&#034; \/&gt;<br \/>\n            &lt;ResourceDictionary Source&#061;&#034;pack:\/\/application:,,,\/MahApps.Metro;component\/Styles\/Accents\/Blue.xaml&#034; \/&gt;<br \/>\n            &lt;ResourceDictionary Source&#061;&#034;pack:\/\/application:,,,\/MahApps.Metro;component\/Styles\/Accents\/BaseLight.xaml&#034; \/&gt;<br \/>\n        &lt;\/ResourceDictionary.MergedDictionaries&gt;<br \/>\n    &lt;\/ResourceDictionary&gt;<br \/>\n&lt;\/Application.Resources&gt; <\/p>\n<p>\u5728\u7a97\u53e3\u4e2d\u4f7f\u7528Metro\u4e3b\u9898<\/p>\n<p>&lt;Controls:MetroWindow x:Class&#061;&#034;MyApp.MainWindow&#034;<br \/>\n        xmlns:Controls&#061;&#034;http:\/\/metro.mahapps.com\/winfx\/xaml\/controls&#034;<br \/>\n        Title&#061;&#034;My App&#034; Height&#061;&#034;600&#034; Width&#061;&#034;800&#034;&gt;<br \/>\n    &lt;!&#8211; \u7a97\u53e3\u5185\u5bb9 &#8211;&gt;<br \/>\n&lt;\/Controls:MetroWindow&gt; <\/p>\n<p>2. \u4f7f\u7528\u52a8\u753b\u6548\u679c \u6b65\u9aa4&#xff1a;<\/p>\n<p>\u5b9a\u4e49Storyboard\u8d44\u6e90<\/p>\n<p>&lt;Window.Resources&gt;<br \/>\n    &lt;Storyboard x:Key&#061;&#034;ButtonHoverAnimation&#034;&gt;<br \/>\n        &lt;DoubleAnimation Storyboard.TargetProperty&#061;&#034;Opacity&#034;<br \/>\n                         From&#061;&#034;0.7&#034; To&#061;&#034;1&#034; Duration&#061;&#034;0:0:0.3&#034;\/&gt;<br \/>\n        &lt;ColorAnimation Storyboard.TargetProperty&#061;&#034;(Button.Background).(SolidColorBrush.Color)&#034;<br \/>\n                       From&#061;&#034;#FF4CAF50&#034; To&#061;&#034;#FF8BC34A&#034; Duration&#061;&#034;0:0:0.3&#034;\/&gt;<br \/>\n    &lt;\/Storyboard&gt;<br \/>\n&lt;\/Window.Resources&gt; <\/p>\n<li>\n<p>\u5728\u63a7\u4ef6\u4e0a\u4f7f\u7528\u89e6\u53d1\u5668\u5e94\u7528\u52a8\u753b<\/p>\n<\/li>\n<p>&lt;Button Content&#061;&#034;Hover Me&#034;&gt;<br \/>\n    &lt;Button.Triggers&gt;<br \/>\n        &lt;EventTrigger RoutedEvent&#061;&#034;Button.MouseEnter&#034;&gt;<br \/>\n            &lt;BeginStoryboard Storyboard&#061;&#034;{StaticResource ButtonHoverAnimation}&#034;\/&gt;<br \/>\n        &lt;\/EventTrigger&gt;<br \/>\n        &lt;EventTrigger RoutedEvent&#061;&#034;Button.MouseLeave&#034;&gt;<br \/>\n            &lt;BeginStoryboard Storyboard&#061;&#034;{StaticResource ButtonHoverAnimation}&#034;\/&gt;<br \/>\n        &lt;\/EventTrigger&gt;<br \/>\n    &lt;\/Button.Triggers&gt;<br \/>\n&lt;\/Button&gt; <\/p>\n<p>\u4e09\u3001\u73b0\u4ee3\u5316UI\u5b9e\u73b0 1. \u4f7f\u7528Material Design \u6b65\u9aa4&#xff1a;<\/p>\n<p>\u5b89\u88c5Material Design\u5e93<\/p>\n<p>NuGet: Install-Package MaterialDesignThemes<\/p>\n<p>\u914d\u7f6eApp.xaml<\/p>\n<p>&lt;Application.Resources&gt;<br \/>\n    &lt;ResourceDictionary&gt;<br \/>\n        &lt;ResourceDictionary.MergedDictionaries&gt;<br \/>\n            &lt;ResourceDictionary Source&#061;&#034;pack:\/\/application:,,,\/MaterialDesignThemes.Wpf;component\/Themes\/MaterialDesignTheme.Light.xaml&#034; \/&gt;<br \/>\n            &lt;ResourceDictionary Source&#061;&#034;pack:\/\/application:,,,\/MaterialDesignThemes.Wpf;component\/Themes\/MaterialDesignTheme.Defaults.xaml&#034; \/&gt;<br \/>\n            &lt;ResourceDictionary Source&#061;&#034;pack:\/\/application:,,,\/MaterialDesignColors;component\/Themes\/Recommended\/Primary\/MaterialDesignColor.DeepPurple.xaml&#034; \/&gt;<br \/>\n            &lt;ResourceDictionary Source&#061;&#034;pack:\/\/application:,,,\/MaterialDesignColors;component\/Themes\/Recommended\/Accent\/MaterialDesignColor.Lime.xaml&#034; \/&gt;<br \/>\n        &lt;\/ResourceDictionary.MergedDictionaries&gt;<br \/>\n    &lt;\/ResourceDictionary&gt;<br \/>\n&lt;\/Application.Resources&gt; <\/p>\n<p>\u4f7f\u7528Material Design\u63a7\u4ef6<\/p>\n<p>&lt;Button Style&#061;&#034;{StaticResource MaterialDesignRaisedButton}&#034;<br \/>\n        Content&#061;&#034;MATERIAL BUTTON&#034;<br \/>\n        Width&#061;&#034;200&#034;<br \/>\n        Margin&#061;&#034;16&#034;\/&gt; <\/p>\n<p>2. \u5b9e\u73b0Fluent Design\u6548\u679c \u6b65\u9aa4&#xff1a;<\/p>\n<p>\u5b89\u88c5Microsoft.Toolkit.Wpf.UI.Controls<\/p>\n<p>NuGet: Install-Package Microsoft.Toolkit.Wpf.UI.Controls<\/p>\n<p>\u5b9e\u73b0\u4e9a\u514b\u529b\u6548\u679c<\/p>\n<p>&lt;Window xmlns:ui&#061;&#034;http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation\/toolkit&#034;<br \/>\n        Background&#061;&#034;{ui:AcrylicBrush TintColor&#061;&#034;#FF330066&#034;<br \/>\n                                   TintOpacity&#061;&#034;0.8&#034;<br \/>\n                                   NoiseOpacity&#061;&#034;0.03&#034;}&#034;&gt;<br \/>\n    &lt;!&#8211; \u7a97\u53e3\u5185\u5bb9 &#8211;&gt;<br \/>\n&lt;\/Window&gt; <\/p>\n<p>\u5b9e\u73b0Reveal\u9ad8\u5149\u6548\u679c<\/p>\n<p>&lt;Button Content&#061;&#034;Reveal Button&#034; Width&#061;&#034;120&#034; Height&#061;&#034;40&#034;&gt;<br \/>\n    &lt;Button.Style&gt;<br \/>\n        &lt;Style TargetType&#061;&#034;Button&#034; BasedOn&#061;&#034;{StaticResource {x:Type Button}}&#034;&gt;<br \/>\n            &lt;Setter Property&#061;&#034;Background&#034; Value&#061;&#034;Transparent&#034;\/&gt;<br \/>\n            &lt;Setter Property&#061;&#034;Template&#034;&gt;<br \/>\n                &lt;Setter.Value&gt;<br \/>\n                    &lt;ControlTemplate TargetType&#061;&#034;Button&#034;&gt;<br \/>\n                        &lt;Border x:Name&#061;&#034;border&#034; Background&#061;&#034;{TemplateBinding Background}&#034;<br \/>\n                                CornerRadius&#061;&#034;4&#034;&gt;<br \/>\n                            &lt;Grid&gt;<br \/>\n                                &lt;Rectangle x:Name&#061;&#034;revealRect&#034; Fill&#061;&#034;White&#034; Opacity&#061;&#034;0&#034;<br \/>\n                                          RadiusX&#061;&#034;4&#034; RadiusY&#061;&#034;4&#034;\/&gt;<br \/>\n                                &lt;ContentPresenter HorizontalAlignment&#061;&#034;Center&#034;<br \/>\n                                                VerticalAlignment&#061;&#034;Center&#034;\/&gt;<br \/>\n                            &lt;\/Grid&gt;<br \/>\n                        &lt;\/Border&gt;<br \/>\n                        &lt;ControlTemplate.Triggers&gt;<br \/>\n                            &lt;Trigger Property&#061;&#034;IsMouseOver&#034; Value&#061;&#034;True&#034;&gt;<br \/>\n                                &lt;Trigger.EnterActions&gt;<br \/>\n                                    &lt;BeginStoryboard&gt;<br \/>\n                                        &lt;Storyboard&gt;<br \/>\n                                            &lt;DoubleAnimation Storyboard.TargetName&#061;&#034;revealRect&#034;<br \/>\n                                                            Storyboard.TargetProperty&#061;&#034;Opacity&#034;<br \/>\n                                                            To&#061;&#034;0.2&#034; Duration&#061;&#034;0:0:0.2&#034;\/&gt;<br \/>\n                                        &lt;\/Storyboard&gt;<br \/>\n                                    &lt;\/BeginStoryboard&gt;<br \/>\n                                &lt;\/Trigger.EnterActions&gt;<br \/>\n                                &lt;Trigger.ExitActions&gt;<br \/>\n                                    &lt;BeginStoryboard&gt;<br \/>\n                                        &lt;Storyboard&gt;<br \/>\n                                            &lt;DoubleAnimation Storyboard.TargetName&#061;&#034;revealRect&#034;<br \/>\n                                                            Storyboard.TargetProperty&#061;&#034;Opacity&#034;<br \/>\n                                                            To&#061;&#034;0&#034; Duration&#061;&#034;0:0:0.4&#034;\/&gt;<br \/>\n                                        &lt;\/Storyboard&gt;<br \/>\n                                    &lt;\/BeginStoryboard&gt;<br \/>\n                                &lt;\/Trigger.ExitActions&gt;<br \/>\n                            &lt;\/Trigger&gt;<br \/>\n                        &lt;\/ControlTemplate.Triggers&gt;<br \/>\n                    &lt;\/ControlTemplate&gt;<br \/>\n                &lt;\/Setter.Value&gt;<br \/>\n            &lt;\/Setter&gt;<br \/>\n        &lt;\/Style&gt;<br \/>\n    &lt;\/Button.Style&gt;<br \/>\n&lt;\/Button&gt; <\/p>\n<p>\u56db\u3001\u81ea\u5b9a\u4e49\u7ed8\u5236\u4e0e\u6548\u679c 1. \u4f7f\u7528VisualBrush\u521b\u5efa\u7279\u6b8a\u6548\u679c<\/p>\n<p>&lt;Button Width&#061;&#034;200&#034; Height&#061;&#034;100&#034;&gt;<br \/>\n    &lt;Button.Background&gt;<br \/>\n        &lt;VisualBrush TileMode&#061;&#034;Tile&#034; Viewport&#061;&#034;0,0,50,50&#034; ViewportUnits&#061;&#034;Absolute&#034;&gt;<br \/>\n            &lt;VisualBrush.Visual&gt;<br \/>\n                &lt;Ellipse Width&#061;&#034;50&#034; Height&#061;&#034;50&#034; Fill&#061;&#034;Blue&#034; Opacity&#061;&#034;0.5&#034;\/&gt;<br \/>\n            &lt;\/VisualBrush.Visual&gt;<br \/>\n        &lt;\/VisualBrush&gt;<br \/>\n    &lt;\/Button.Background&gt;<br \/>\n    &lt;Button.Content&gt;<br \/>\n        &lt;TextBlock Text&#061;&#034;Pattern Button&#034; Foreground&#061;&#034;White&#034; FontSize&#061;&#034;16&#034;\/&gt;<br \/>\n    &lt;\/Button.Content&gt;<br \/>\n&lt;\/Button&gt; <\/p>\n<p>2. \u4f7f\u7528BlurEffect\u548cDropShadowEffect<\/p>\n<p>&lt;Grid&gt;<br \/>\n    &lt;Grid.Effect&gt;<br \/>\n        &lt;DropShadowEffect BlurRadius&#061;&#034;10&#034; ShadowDepth&#061;&#034;5&#034; Color&#061;&#034;#88000000&#034;\/&gt;<br \/>\n    &lt;\/Grid.Effect&gt;<\/p>\n<p>    &lt;Border Background&#061;&#034;White&#034; CornerRadius&#061;&#034;5&#034; Padding&#061;&#034;20&#034;&gt;<br \/>\n        &lt;TextBlock Text&#061;&#034;Shadow Effect&#034; FontSize&#061;&#034;24&#034;\/&gt;<br \/>\n    &lt;\/Border&gt;<br \/>\n&lt;\/Grid&gt; <\/p>\n<p>\u4e94\u3001\u54cd\u5e94\u5f0f\u4e0e\u81ea\u9002\u5e94\u8bbe\u8ba1 1. \u4f7f\u7528ViewBox\u5b9e\u73b0\u7f29\u653e<\/p>\n<p>&lt;Viewbox Stretch&#061;&#034;Uniform&#034;&gt;<br \/>\n    &lt;StackPanel Width&#061;&#034;400&#034;&gt;<br \/>\n        &lt;!&#8211; \u5185\u5bb9\u4f1a\u81ea\u52a8\u7f29\u653e &#8211;&gt;<br \/>\n        &lt;Button Content&#061;&#034;Scalable Button&#034; Margin&#061;&#034;10&#034;\/&gt;<br \/>\n        &lt;TextBox Text&#061;&#034;Scalable TextBox&#034; Margin&#061;&#034;10&#034;\/&gt;<br \/>\n    &lt;\/StackPanel&gt;<br \/>\n&lt;\/Viewbox&gt; <\/p>\n<p>2. \u4f7f\u7528\u81ea\u9002\u5e94\u5e03\u5c40\u9762\u677f<\/p>\n<p>&lt;UniformGrid Columns&#061;&#034;3&#034; Rows&#061;&#034;2&#034;&gt;<br \/>\n    &lt;Button Content&#061;&#034;Button 1&#034;\/&gt;<br \/>\n    &lt;Button Content&#061;&#034;Button 2&#034;\/&gt;<br \/>\n    &lt;Button Content&#061;&#034;Button 3&#034;\/&gt;<br \/>\n    &lt;Button Content&#061;&#034;Button 4&#034;\/&gt;<br \/>\n    &lt;Button Content&#061;&#034;Button 5&#034;\/&gt;<br \/>\n    &lt;Button Content&#061;&#034;Button 6&#034;\/&gt;<br \/>\n&lt;\/UniformGrid&gt; <\/p>\n<p>\u516d\u3001\u7efc\u5408\u7f8e\u5316\u793a\u4f8b<\/p>\n<p>&lt;Window x:Class&#061;&#034;WpfApp.MainWindow&#034;<br \/>\n        xmlns&#061;&#034;http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation&#034;<br \/>\n        xmlns:x&#061;&#034;http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml&#034;<br \/>\n        Title&#061;&#034;Modern WPF App&#034; Height&#061;&#034;450&#034; Width&#061;&#034;800&#034;<br \/>\n        WindowStartupLocation&#061;&#034;CenterScreen&#034;&gt;<\/p>\n<p>    &lt;Window.Resources&gt;<br \/>\n        &lt;!&#8211; \u6e10\u53d8\u80cc\u666f\u753b\u7b14 &#8211;&gt;<br \/>\n        &lt;LinearGradientBrush x:Key&#061;&#034;AppBackground&#034; StartPoint&#061;&#034;0,0&#034; EndPoint&#061;&#034;1,1&#034;&gt;<br \/>\n            &lt;GradientStop Color&#061;&#034;#FF1A2980&#034; Offset&#061;&#034;0&#034;\/&gt;<br \/>\n            &lt;GradientStop Color&#061;&#034;#FF26D0CE&#034; Offset&#061;&#034;1&#034;\/&gt;<br \/>\n        &lt;\/LinearGradientBrush&gt;<\/p>\n<p>        &lt;!&#8211; \u5361\u7247\u6837\u5f0f &#8211;&gt;<br \/>\n        &lt;Style x:Key&#061;&#034;CardStyle&#034; TargetType&#061;&#034;Border&#034;&gt;<br \/>\n            &lt;Setter Property&#061;&#034;Background&#034; Value&#061;&#034;#20FFFFFF&#034;\/&gt;<br \/>\n            &lt;Setter Property&#061;&#034;CornerRadius&#034; Value&#061;&#034;10&#034;\/&gt;<br \/>\n            &lt;Setter Property&#061;&#034;Padding&#034; Value&#061;&#034;20&#034;\/&gt;<br \/>\n            &lt;Setter Property&#061;&#034;Effect&#034;&gt;<br \/>\n                &lt;Setter.Value&gt;<br \/>\n                    &lt;DropShadowEffect BlurRadius&#061;&#034;15&#034; ShadowDepth&#061;&#034;5&#034; Opacity&#061;&#034;0.3&#034;\/&gt;<br \/>\n                &lt;\/Setter.Value&gt;<br \/>\n            &lt;\/Setter&gt;<br \/>\n        &lt;\/Style&gt;<\/p>\n<p>        &lt;!&#8211; \u73b0\u4ee3\u6309\u94ae\u6837\u5f0f &#8211;&gt;<br \/>\n        &lt;Style x:Key&#061;&#034;ModernButton&#034; TargetType&#061;&#034;Button&#034;&gt;<br \/>\n            &lt;Setter Property&#061;&#034;Background&#034; Value&#061;&#034;#20FFFFFF&#034;\/&gt;<br \/>\n            &lt;Setter Property&#061;&#034;Foreground&#034; Value&#061;&#034;White&#034;\/&gt;<br \/>\n            &lt;Setter Property&#061;&#034;BorderThickness&#034; Value&#061;&#034;0&#034;\/&gt;<br \/>\n            &lt;Setter Property&#061;&#034;Padding&#034; Value&#061;&#034;15 8&#034;\/&gt;<br \/>\n            &lt;Setter Property&#061;&#034;FontSize&#034; Value&#061;&#034;14&#034;\/&gt;<br \/>\n            &lt;Setter Property&#061;&#034;Cursor&#034; Value&#061;&#034;Hand&#034;\/&gt;<br \/>\n            &lt;Setter Property&#061;&#034;Template&#034;&gt;<br \/>\n                &lt;Setter.Value&gt;<br \/>\n                    &lt;ControlTemplate TargetType&#061;&#034;Button&#034;&gt;<br \/>\n                        &lt;Border x:Name&#061;&#034;border&#034;<br \/>\n                                Background&#061;&#034;{TemplateBinding Background}&#034;<br \/>\n                                CornerRadius&#061;&#034;5&#034;&gt;<br \/>\n                            &lt;ContentPresenter HorizontalAlignment&#061;&#034;Center&#034;<br \/>\n                                            VerticalAlignment&#061;&#034;Center&#034;\/&gt;<br \/>\n                        &lt;\/Border&gt;<br \/>\n                        &lt;ControlTemplate.Triggers&gt;<br \/>\n                            &lt;Trigger Property&#061;&#034;IsMouseOver&#034; Value&#061;&#034;True&#034;&gt;<br \/>\n                                &lt;Setter TargetName&#061;&#034;border&#034; Property&#061;&#034;Background&#034; Value&#061;&#034;#40FFFFFF&#034;\/&gt;<br \/>\n                            &lt;\/Trigger&gt;<br \/>\n                            &lt;Trigger Property&#061;&#034;IsPressed&#034; Value&#061;&#034;True&#034;&gt;<br \/>\n                                &lt;Setter TargetName&#061;&#034;border&#034; Property&#061;&#034;Background&#034; Value&#061;&#034;#60FFFFFF&#034;\/&gt;<br \/>\n                            &lt;\/Trigger&gt;<br \/>\n                        &lt;\/ControlTemplate.Triggers&gt;<br \/>\n                    &lt;\/ControlTemplate&gt;<br \/>\n                &lt;\/Setter.Value&gt;<br \/>\n            &lt;\/Setter&gt;<br \/>\n        &lt;\/Style&gt;<br \/>\n    &lt;\/Window.Resources&gt;<\/p>\n<p>    &lt;Grid Background&#061;&#034;{StaticResource AppBackground}&#034;&gt;<br \/>\n        &lt;Grid Margin&#061;&#034;20&#034;&gt;<br \/>\n            &lt;Grid.RowDefinitions&gt;<br \/>\n                &lt;RowDefinition Height&#061;&#034;Auto&#034;\/&gt;<br \/>\n                &lt;RowDefinition Height&#061;&#034;*&#034;\/&gt;<br \/>\n            &lt;\/Grid.RowDefinitions&gt;<\/p>\n<p>            &lt;!&#8211; \u6807\u9898 &#8211;&gt;<br \/>\n            &lt;TextBlock Text&#061;&#034;Modern WPF Application&#034;<br \/>\n                       Foreground&#061;&#034;White&#034;<br \/>\n                       FontSize&#061;&#034;24&#034;<br \/>\n                       FontWeight&#061;&#034;Light&#034;<br \/>\n                       Margin&#061;&#034;0 0 0 20&#034;\/&gt;<\/p>\n<p>            &lt;!&#8211; \u5185\u5bb9\u5361\u7247 &#8211;&gt;<br \/>\n            &lt;Border Grid.Row&#061;&#034;1&#034; Style&#061;&#034;{StaticResource CardStyle}&#034;&gt;<br \/>\n                &lt;StackPanel&gt;<br \/>\n                    &lt;TextBlock Text&#061;&#034;Welcome to the modern UI&#034;<br \/>\n                               Foreground&#061;&#034;White&#034;<br \/>\n                               FontSize&#061;&#034;18&#034;<br \/>\n                               Margin&#061;&#034;0 0 0 20&#034;\/&gt;<\/p>\n<p>                    &lt;TextBox Style&#061;&#034;{StaticResource MaterialDesignOutlinedTextBox}&#034;<br \/>\n                             materialDesign:HintAssist.Hint&#061;&#034;Username&#034;<br \/>\n                             Margin&#061;&#034;0 0 0 15&#034;<br \/>\n                             Foreground&#061;&#034;White&#034;\/&gt;<\/p>\n<p>                    &lt;PasswordBox Style&#061;&#034;{StaticResource MaterialDesignOutlinedPasswordBox}&#034;<br \/>\n                                 materialDesign:HintAssist.Hint&#061;&#034;Password&#034;<br \/>\n                                 Margin&#061;&#034;0 0 0 25&#034;<br \/>\n                                 Foreground&#061;&#034;White&#034;\/&gt;<\/p>\n<p>                    &lt;Button Content&#061;&#034;SIGN IN&#034;<br \/>\n                            Style&#061;&#034;{StaticResource ModernButton}&#034;<br \/>\n                            HorizontalAlignment&#061;&#034;Right&#034;\/&gt;<br \/>\n                &lt;\/StackPanel&gt;<br \/>\n            &lt;\/Border&gt;<br \/>\n        &lt;\/Grid&gt;<br \/>\n    &lt;\/Grid&gt;<br \/>\n&lt;\/Window&gt; <\/p>\n<p>\u603b\u7ed3 WPF\u754c\u9762\u7f8e\u5316\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5b9e\u73b0&#xff1a;<\/p>\n<p>\u57fa\u7840\u65b9\u6cd5&#xff1a;\u6837\u5f0f\u3001\u6a21\u677f\u3001\u89e6\u53d1\u5668<\/p>\n<p>\u4e3b\u9898\u5e93&#xff1a;MahApps.Metro\u3001Material Design\u7b49<\/p>\n<p>\u89c6\u89c9\u6548\u679c&#xff1a;\u52a8\u753b\u3001\u9634\u5f71\u3001\u6a21\u7cca\u3001\u6e10\u53d8\u7b49<\/p>\n<p>\u73b0\u4ee3\u5316\u8bbe\u8ba1&#xff1a;Fluent Design\u3001\u4e9a\u514b\u529b\u6548\u679c\u3001Reveal\u9ad8\u5149<\/p>\n<p>\u54cd\u5e94\u5f0f\u8bbe\u8ba1&#xff1a;\u81ea\u9002\u5e94\u5e03\u5c40\u3001ViewBox\u7b49<\/p>\n<p>\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u7ec4\u5408\u4f7f\u7528&#xff0c;\u53ef\u4ee5\u521b\u5efa\u51fa\u4e13\u4e1a\u3001\u7f8e\u89c2\u7684WPF\u5e94\u7528\u7a0b\u5e8f\u754c\u9762\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb175\u6b21\uff0c\u70b9\u8d5e4\u6b21\uff0c\u6536\u85cf5\u6b21\u3002wpf<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,1862],"topic":[],"class_list":["post-45028","post","type-post","status-publish","format-standard","hentry","category-server","tag-c","tag-wpf"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C# WPF\u7a0b\u5e8f\u754c\u9762\u7f8e\u5316\u65b9\u6cd5\u4e0e\u8be6\u7ec6\u6b65\u9aa4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/45028.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C# WPF\u7a0b\u5e8f\u754c\u9762\u7f8e\u5316\u65b9\u6cd5\u4e0e\u8be6\u7ec6\u6b65\u9aa4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb175\u6b21\uff0c\u70b9\u8d5e4\u6b21\uff0c\u6536\u85cf5\u6b21\u3002wpf\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/45028.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-21T18:22:49+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/45028.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/45028.html\",\"name\":\"C# WPF\u7a0b\u5e8f\u754c\u9762\u7f8e\u5316\u65b9\u6cd5\u4e0e\u8be6\u7ec6\u6b65\u9aa4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-06-21T18:22:49+00:00\",\"dateModified\":\"2025-06-21T18:22:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/45028.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/45028.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/45028.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C# WPF\u7a0b\u5e8f\u754c\u9762\u7f8e\u5316\u65b9\u6cd5\u4e0e\u8be6\u7ec6\u6b65\u9aa4\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C# WPF\u7a0b\u5e8f\u754c\u9762\u7f8e\u5316\u65b9\u6cd5\u4e0e\u8be6\u7ec6\u6b65\u9aa4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/45028.html","og_locale":"zh_CN","og_type":"article","og_title":"C# WPF\u7a0b\u5e8f\u754c\u9762\u7f8e\u5316\u65b9\u6cd5\u4e0e\u8be6\u7ec6\u6b65\u9aa4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb175\u6b21\uff0c\u70b9\u8d5e4\u6b21\uff0c\u6536\u85cf5\u6b21\u3002wpf","og_url":"https:\/\/www.wsisp.com\/helps\/45028.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-06-21T18:22:49+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/45028.html","url":"https:\/\/www.wsisp.com\/helps\/45028.html","name":"C# WPF\u7a0b\u5e8f\u754c\u9762\u7f8e\u5316\u65b9\u6cd5\u4e0e\u8be6\u7ec6\u6b65\u9aa4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-06-21T18:22:49+00:00","dateModified":"2025-06-21T18:22:49+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/45028.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/45028.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/45028.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"C# WPF\u7a0b\u5e8f\u754c\u9762\u7f8e\u5316\u65b9\u6cd5\u4e0e\u8be6\u7ec6\u6b65\u9aa4"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/45028","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=45028"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/45028\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=45028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=45028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=45028"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=45028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}