2 < Style x:Key ="TextBoxStyle" targettype ="TextBox" >
3 这里定义具体样式属性
4 </ Style >
5 </ UserControl.Resources >
2 <ControlTemplate x:Key="TextBoxTemplate" targettype="TextBox" >
3 <border borderBrush="Orange" borderThickness="3" CornerRadius="10"
4 Background="Red">
5 这里定义具体模板
6 </border>
7 </ControlTemplate>
8 </UserControl.Resources>
2 < Style x:Key ="buttonStyle1" targettype ="button" >
3 < Setter Property ="Background" Value ="#FF1F3B53" />
4 < Setter Property ="Foreground" Value ="#FF000000" />
5 < Setter Property ="padding" Value ="3" />
6 < Setter Property ="borderThickness" Value ="1" />
7 < Setter Property ="borderBrush" >
8 < Setter.Value >
9 < linearGradIEntBrush EndPoint ="0.5,1" StartPoint ="0.5,0" >
10 < GradIEntStop color ="#FFA3AEB9" Offset ="0" />
11 < GradIEntStop color ="#FF8399A9" Offset ="0.375" />
12 < GradIEntStop color ="#FF718597" Offset ="0.375" />
13 < GradIEntStop color ="#FF617584" Offset ="1" />
14 </ linearGradIEntBrush >
15 </ Setter.Value >
16 </ Setter >
17 < Setter Property ="Template" >
18 < Setter.Value >
19 < ControlTemplate targettype ="button" >
20 < GrID >
21 < visualstatemanager.VisualStateGroups >
22 < VisualStateGroup x:name ="CommonStates" >
23 < VisualState x:name ="normal" />
24 < VisualState x:name ="MouSEOver" >
25 < Storyboard >
26 < DoubleAnimationUsingKeyFrames Storyboard.Targetname ="BackgroundAnimation" Storyboard.TargetProperty ="Opacity" >
27 < SplineDoubleKeyFrame KeyTime ="0" Value ="1" />
28 </ DoubleAnimationUsingKeyFrames >
29 < colorAnimationUsingKeyFrames Storyboard.Targetname ="BackgroundGradIEnt" Storyboard.TargetProperty ="(Rectangle.Fill).(GradIEntBrush.GradIEntStops)[1].(GradIEntStop.color)" >
30 < SplinecolorKeyFrame KeyTime ="0" Value ="#F2FFFFFF" />
31 </ colorAnimationUsingKeyFrames >
32 < colorAnimationUsingKeyFrames Storyboard.Targetname ="BackgroundGradIEnt" Storyboard.TargetProperty ="(Rectangle.Fill).(GradIEntBrush.GradIEntStops)[2].(GradIEntStop.color)" >
33 < SplinecolorKeyFrame KeyTime ="0" Value ="#CCFFFFFF" />
34 </ colorAnimationUsingKeyFrames >
35 < colorAnimationUsingKeyFrames Storyboard.Targetname ="BackgroundGradIEnt" Storyboard.TargetProperty ="(Rectangle.Fill).(GradIEntBrush.GradIEntStops)[3].(GradIEntStop.color)" >
36 < SplinecolorKeyFrame KeyTime ="0" Value ="#7FFFFFFF" />
37 </ colorAnimationUsingKeyFrames >
38 </ Storyboard >
39 </ VisualState >
40 < VisualState x:name ="pressed" >
41 < Storyboard >
42 < colorAnimationUsingKeyFrames Storyboard.Targetname ="Background" Storyboard.TargetProperty ="(border.Background).(SolIDcolorBrush.color)" >
43 < SplinecolorKeyFrame KeyTime ="0" Value ="#FF6DBDD1" />
44 </ colorAnimationUsingKeyFrames >
45 < DoubleAnimationUsingKeyFrames Storyboard.Targetname ="BackgroundAnimation" Storyboard.TargetProperty ="Opacity" >
46 < SplineDoubleKeyFrame KeyTime ="0" Value ="1" />
47 </ DoubleAnimationUsingKeyFrames >
48 < colorAnimationUsingKeyFrames Storyboard.Targetname ="BackgroundGradIEnt" Storyboard.TargetProperty ="(Rectangle.Fill).(GradIEntBrush.GradIEntStops)[0].(GradIEntStop.color)" >
49 < SplinecolorKeyFrame KeyTime ="0" Value ="#D8FFFFFF" />
50 </ colorAnimationUsingKeyFrames >
51 < colorAnimationUsingKeyFrames Storyboard.Targetname ="BackgroundGradIEnt" Storyboard.TargetProperty ="(Rectangle.Fill).(GradIEntBrush.GradIEntStops)[1].(GradIEntStop.color)" >
52 < SplinecolorKeyFrame KeyTime ="0" Value ="#C6FFFFFF" />
53 </ colorAnimationUsingKeyFrames >
54 < colorAnimationUsingKeyFrames Storyboard.Targetname ="BackgroundGradIEnt" Storyboard.TargetProperty ="(Rectangle.Fill).(GradIEntBrush.GradIEntStops)[2].(GradIEntStop.color)" >
55 < SplinecolorKeyFrame KeyTime ="0" Value ="#8CFFFFFF" />
56 </ colorAnimationUsingKeyFrames >
57 < colorAnimationUsingKeyFrames Storyboard.Targetname ="BackgroundGradIEnt" Storyboard.TargetProperty ="(Rectangle.Fill).(GradIEntBrush.GradIEntStops)[3].(GradIEntStop.color)" >
58 < SplinecolorKeyFrame KeyTime ="0" Value ="#3FFFFFFF" />
59 </ colorAnimationUsingKeyFrames >
60 </ Storyboard >
61 </ VisualState >
62 < VisualState x:name ="Disabled" >
63 < Storyboard >
64 < DoubleAnimationUsingKeyFrames Storyboard.Targetname ="DisabledVisualElement" Storyboard.TargetProperty ="Opacity" >
65 < SplineDoubleKeyFrame KeyTime ="0" Value =".55" />
66 </ DoubleAnimationUsingKeyFrames >
67 </ Storyboard >
68 </ VisualState >
69 </ VisualStateGroup >
70 < VisualStateGroup x:name ="Focusstates" >
71 < VisualState x:name ="Focused" >
72 < Storyboard >
73 < DoubleAnimationUsingKeyFrames Storyboard.Targetname ="FocusVisualElement" Storyboard.TargetProperty ="Opacity" >
74 < SplineDoubleKeyFrame KeyTime ="0" Value ="1" />
75 </ DoubleAnimationUsingKeyFrames >
76 </ Storyboard >
77 </ VisualState >
78 < VisualState x:name ="Unfocused" />
79 </ VisualStateGroup >
80 </ visualstatemanager.VisualStateGroups >
81 < border x:name ="Background" Background ="White" borderBrush =" {TemplateBinding borderBrush} " borderThickness =" {TemplateBinding borderThickness} " CornerRadius ="3" >
82 < GrID margin ="1" Background =" {TemplateBinding Background} " >
83 < border x:name ="BackgroundAnimation" Opacity ="0" Background ="#FF448DCA" />
84 < Rectangle x:name ="BackgroundGradIEnt" >
85 < Rectangle.Fill >
86 < linearGradIEntBrush EndPoint =".7,1" StartPoint =".7,0" >
87 < GradIEntStop color ="#FFFFFFFF" Offset ="0" />
88 < GradIEntStop color ="#F9FFFFFF" Offset ="0.375" />
89 < GradIEntStop color ="#E5FFFFFF" Offset ="0.625" />
90 < GradIEntStop color ="#C6FFFFFF" Offset ="1" />
91 </ linearGradIEntBrush >
92 </ Rectangle.Fill >
93 </ Rectangle >
94 </ GrID >
95 </ border >
96 < ContentPresenter x:name ="contentPresenter" HorizontalAlignment =" {TemplateBinding HorizontalContentAlignment} " margin =" {TemplateBinding padding} " VerticalAlignment =" {TemplateBinding VerticalContentAlignment} " Content =" {TemplateBinding Content} " ContentTemplate =" {TemplateBinding ContentTemplate} " />
97 < Rectangle x:name ="DisabledVisualElement" Fill ="#FFFFFFFF" RadiusX ="3" RadiusY ="3" IsHitTestVisible ="false" Opacity ="0" />
98 < Rectangle x:name ="FocusVisualElement" stroke ="#FF6DBDD1" strokeThickness ="1" RadiusX ="2" RadiusY ="2" margin ="1" IsHitTestVisible ="false" Opacity ="0" />
99 </ GrID >
100 </ ControlTemplate >
101 </ Setter.Value >
102 </ Setter >
103 </ Style >
104 </ ResourceDictionary >
2 < button x:name ="bt1" margin ="254,151,247,0" WIDth ="139" Content ="按钮样式" Style =" {StaticResource buttonStyle1} " Height ="55" VerticalAlignment ="top" />
3 < button margin ="0,92,0" WIDth ="139" Content ="button" HorizontalAlignment ="Right" d:LayoutOverrIDes ="WIDth" Height ="55" VerticalAlignment ="top" />
4 < button margin ="94,0" WIDth ="139" Content ="button" HorizontalAlignment ="left" d:LayoutOverrIDes ="WIDth" Style =" {StaticResource buttonStyle1} " Height ="55" VerticalAlignment ="top" />
5 </ GrID >
以上是内存溢出为你收集整理的Expression Blend实例中文教程(12) - 样式和模板快速入门Style,Template全部内容,希望文章能够帮你解决Expression Blend实例中文教程(12) - 样式和模板快速入门Style,Template所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)