& ltsetter Property = \" Foreground \" Value = \" Black \"/>& " />
當前位置:成語大全網 - 書法字典 - Wpf字體燈和按鈕燈

Wpf字體燈和按鈕燈

給個樣式,放在資源字典裏就行了,效果不錯。

& lt!-定義按鈕樣式-& gt;

& ltStyle TargetType="Button " >

& ltsetter Property = " Foreground " Value = " Black "/>

& lt!-修改模板屬性-& gt;

& ltSetter Property = " Template " & gt

& lt二傳。值& gt

& lt!-控制模板->;

& ltcontrol template target type = " Button " & gt;

& lt!-背景色-& gt;

& ltborder x:Name = " back " Opacity = " 0.8 " corner radius = " 3 " >

& lt邊框。BitmapEffect & gt

& ltOuterGlowBitmapEffect Opacity = " 0.7 " glow size = " 0 " glow color = " { Binding relative source = { relative source templated parent },Path=(Button。背景)。(SolidColorBrush。color)} "/& gt;

& lt/Border。BitmapEffect & gt

& lt邊框。背景& gt

& ltLinearGradientBrush start point = " 0,0" EndPoint="0,1.5 " >

& ltGradientBrush。GradientStops & gt

& ltGradientStopCollection & gt

& ltgradient stop Color = " { Binding relative source = { relative source templated parent },Path=(Button。背景)。(SolidColorBrush。color)} " Offset = " 0 "/& gt;

& ltgradient stop Color = " { Binding relative source = { relative source templated parent },Path=(Button。背景)。(SolidColorBrush。color)} " Offset = " 0.4 "/& gt;

& ltgradient stop Color = " # FFF " Offset = " 1 "/& gt;

& lt/GradientStopCollection & gt;

& lt/GradientBrush。GradientStops & gt

& lt/LinearGradientBrush & gt;

& lt/Border。背景& gt

& lt!-前景和邊框-& gt;

& ltborder x:Name = " fore " border thickness = " 1 " corner radius = " 3 " border brush = " # 5555 " & gt;

& lt邊框。背景& gt

& ltLinearGradientBrush start point = " 0,0" EndPoint="0,1 " >

& ltGradientBrush。GradientStops & gt

& ltGradientStopCollection & gt

& ltgradient stop Color = " # 6 fff " Offset = " 0.5 "/& gt;

& ltgradient stop Color = " # 1111 " Offset = " 0.51 "/>

& lt/GradientStopCollection & gt;

& lt/GradientBrush。GradientStops & gt

& lt/LinearGradientBrush & gt;

& lt/Border。背景& gt

& lt!-按鈕內容-& gt;

& ltContent presenter x:Name = " Content " horizontal alignment = " Center " vertical alignment = " Center " Content = " { template binding Content } " & gt;

& ltContentPresenter。BitmapEffect & gt

& ltDropShadowBitmapEffect Color = " # 000 " Direction = "-90 " shadow depth = " 2 " Softness = " 0.1 " Opacity = " 0.3 "/& gt;

& lt/內容演示者。BitmapEffect & gt

& lt/content presenter & gt;

& lt/Border & gt;

& lt/Border & gt;

& lt!-觸發器->;

& lt控件模板。觸發器& gt

& lt!-內外移動鼠標-& gt;

& lttrigger Property = " IsMouseOver " Value = " True " & gt;

& lt扳機。EnterActions & gt

& ltBeginStoryboard & gt

& lt故事板& gt

& ltdouble animation To = " 6 " Duration = " 0:0:0.2 "故事板。TargetName="back "故事板。TargetProperty="(Border。BitmapEffect)。(OuterGlowBitmapEffect。glow size)"/& gt;

& ltcolor animation To = " # AFFF " begin time = " 0:0:0.2 " Duration = " 0:0:0.2 "故事板。TargetName="fore "故事板。TargetProperty="(Border。背景)。(LinearGradientBrush。GradientStops)[0]。(GradientStop。color)"/>;

& ltcolor animation To = " # 3 fff " begin time = " 0:0:0.2 " Duration = " 0:0:0.2 "故事板。TargetName="fore "故事板。TargetProperty="(Border。背景)。(LinearGradientBrush。GradientStops)[1]。(GradientStop。color)"/>;

& lt/story board & gt;

& lt/BeginStoryboard & gt;

& lt/觸發器。EnterActions & gt

& lt扳機。ExitActions & gt

& ltBeginStoryboard & gt

& lt故事板& gt

& ltdouble animation Duration = " 0:0:0.2 "情節提要。TargetName="back "故事板。TargetProperty="(Border。BitmapEffect)。(OuterGlowBitmapEffect。glow size)"/& gt;

& ltcolor animation Duration = " 0:0:0.2 "情節提要。TargetName="fore "故事板。TargetProperty="(Border。背景)。(LinearGradientBrush。GradientStops)[0]。(GradientStop。color)"/>;

& ltcolor animation Duration = " 0:0:0.2 "情節提要。TargetName="fore "故事板。TargetProperty="(Border。背景)。(LinearGradientBrush。GradientStops)[1]。(GradientStop。color)"/>;

& lt/story board & gt;

& lt/BeginStoryboard & gt;

& lt/觸發器。ExitActions & gt

& lt/Trigger & gt;

& lt!-按按鈕彈出-& gt;

& lttrigger Property = " is pressed " Value = " True " & gt;

& lt扳機。EnterActions & gt

& ltBeginStoryboard & gt

& lt故事板& gt

& ltdouble animation To = " 3 " Duration = " 0:0:0.1 "故事板。TargetName="back "故事板。TargetProperty="(Border。BitmapEffect)。(OuterGlowBitmapEffect。glow size)"/& gt;

& ltcolor animation To = " # 3a aa " Duration = " 0:0:0.1 "故事板。TargetName="fore "故事板。TargetProperty="(Border。背景)。(LinearGradientBrush。GradientStops)[0]。(GradientStop。color)"/>;

& ltcolor animation To = " # 2111 " Duration = " 0:0:0.1 "故事板。TargetName="fore "故事板。TargetProperty="(Border。背景)。(LinearGradientBrush。GradientStops)[1]。(GradientStop。color)"/>;

& lt/story board & gt;

& lt/BeginStoryboard & gt;

& lt/觸發器。EnterActions & gt

& lt扳機。ExitActions & gt

& ltBeginStoryboard & gt

& lt故事板& gt

& ltdouble animation Duration = " 0:0:0.1 "故事板。TargetName="back "故事板。TargetProperty="(Border。BitmapEffect)。(OuterGlowBitmapEffect。glow size)"/& gt;

& ltcolor animation Duration = " 0:0:0.1 "故事板。TargetName="fore "故事板。TargetProperty="(Border。背景)。(LinearGradientBrush。GradientStops)[0]。(GradientStop。color)"/>;

& ltcolor animation Duration = " 0:0:0.1 "故事板。TargetName="fore "故事板。TargetProperty="(Border。背景)。(LinearGradientBrush。GradientStops)[1]。(GradientStop。color)"/>;

& lt/story board & gt;

& lt/BeginStoryboard & gt;

& lt/觸發器。ExitActions & gt

& lt/Trigger & gt;

& lt!-按鈕無效-& gt;

& lttrigger Property = " is enabled " Value = " False " & gt;

& ltsetter Property = " Foreground " Value = " # B444 "/& gt;

& lt扳機。EnterActions & gt

& ltBeginStoryboard & gt

& lt故事板& gt

& ltdouble animation To = " 0 " Duration = " 0:0:0.3 "故事板。TargetName="back "故事板。TargetProperty="(Border。BitmapEffect)。(OuterGlowBitmapEffect。glow size)"/& gt;

& ltdouble animation To = " 1 " Duration = " 0:0:0.1 "故事板。TargetName="content "故事板。target property = "(content presenter。BitmapEffect)。(DropShadowBitmapEffect。不透明度)"/>;

& ltdouble animation To = "-135 " Duration = " 0:0:0.1 "故事板。TargetName="content "故事板。target property = "(content presenter。BitmapEffect)。(DropShadowBitmapEffect。方向)"/>;

& ltcolor animation To = " # FFF " Duration = " 0:0:0.3 "故事板。TargetName="content "故事板。target property = "(content presenter。BitmapEffect)。(DropShadowBitmapEffect。color)"/>;

& ltcolor animation To = " # D555 " Duration = " 0:0:0.3 "故事板。TargetName="fore "故事板。TargetProperty="(Border。BorderBrush)。(SolidColorBrush。color)"/>;

& ltcolor animation To = " # CEEE " Duration = " 0:0:0.3 "故事板。TargetName="fore "故事板。TargetProperty="(Border。背景)。(LinearGradientBrush。GradientStops)[0]。(GradientStop。color)"/>;

& ltcolor animation To = " # CDDD " Duration = " 0:0:0.3 "故事板。TargetName="fore "故事板。TargetProperty="(Border。背景)。(LinearGradientBrush。GradientStops)[1]。(GradientStop。color)"/>;

& lt/story board & gt;

& lt/BeginStoryboard & gt;

& lt/觸發器。EnterActions & gt

& lt扳機。ExitActions & gt

& ltBeginStoryboard & gt

& lt故事板& gt

& ltdouble animation Duration = " 0:0:0.1 "故事板。TargetName="back "故事板。TargetProperty="(Border。BitmapEffect)。(OuterGlowBitmapEffect。glow size)"/& gt;

& ltdouble animation Duration = " 0:0:0.1 "故事板。TargetName="content "故事板。target property = "(content presenter。BitmapEffect)。(DropShadowBitmapEffect。不透明度)"/>;

& ltdouble animation Duration = " 0:0:0.1 "故事板。TargetName="content "故事板。target property = "(content presenter。BitmapEffect)。(DropShadowBitmapEffect。方向)"/>;

& ltcolor animation Duration = " 0:0:0.1 "故事板。TargetName="content "故事板。target property = "(content presenter。BitmapEffect)。(DropShadowBitmapEffect。color)"/>;

& ltcolor animation Duration = " 0:0:0.1 "故事板。TargetName="fore "故事板。TargetProperty="(Border。BorderBrush)。(SolidColorBrush。color)"/>;

& ltcolor animation Duration = " 0:0:0.1 "故事板。TargetName="fore "故事板。TargetProperty="(Border。背景)。(LinearGradientBrush。GradientStops)[0]。(GradientStop。color)"/>;

& ltcolor animation Duration = " 0:0:0.1 "故事板。TargetName="fore "故事板。TargetProperty="(Border。背景)。(LinearGradientBrush。GradientStops)[1]。(GradientStop。color)"/>;

& lt/story board & gt;

& lt/BeginStoryboard & gt;

& lt/觸發器。ExitActions & gt

& lt/Trigger & gt;

& lt/ControlTemplate觸發器& gt

& lt/control template & gt;

& lt/Setter。值& gt

& lt/Setter & gt;

& lt/Style & gt;