Win8将Windows的风格又进行了一次变革,我还挺喜欢的,有简洁大气的感觉,华丽绚丽的东西看多了之后总会返璞归真寻找简洁大气的感觉才能心情舒畅。
下面就给个WPF下Button的自定义写法。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
< Button Content = "Im Button! Click Me。" Height = "94" HorizontalAlignment = "Left" Name = "button1" VerticalAlignment = "Top" Width = "174" Foreground = "#FFFCFCFC" FontSize = "18" FontWeight = "Bold" >
< Button.Template >
< ControlTemplate TargetType = "{x:Type Button}" >
< Border BorderBrush = "Transparent" BorderThickness = "0" Background = "#FFc6178a" Name = "PART_Background" >
< ContentPresenter Content = "{TemplateBinding ContentControl.Content}" HorizontalAlignment = "Center" VerticalAlignment = "Center" />
</ Border >
< ControlTemplate.Triggers >
< Trigger Property = "UIElement.IsMouseOver" Value = "True" >
< Setter Property = "Border.Background" TargetName = "PART_Background" Value = "#FFe923a5" />
</ Trigger >
</ ControlTemplate.Triggers >
</ ControlTemplate >
</ Button.Template >
</ Button >
|
哈哈,看了上面代码是不是有种上当的感觉啊??
其实只是像而已,其实上面的代码会消耗点内存,可以再优化的,但是现在内存飙升,动辄N个G的内存来说也不会有啥影响。