Win8将Windows的风格又进行了一次变革,我还挺喜欢的,有简洁大气的感受,华丽绚丽的东西看多了以后总会返璞归真寻找简洁大气的感受才能心情舒畅。优化
下面就给个WPF下Button的自定义写法。spa
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 >
|
哈哈,看了上面代码是否是有种上当的感受啊??code
其实只是像而已,其实上面的代码会消耗点内存,能够再优化的,可是如今内存飙升,动辄N个G的内存来讲也不会有啥影响。xml