WPF Button Style Original template

Source: Internet
Author: User

This is the button original style, understand how to change the love how to change
<Window.Resources>
<style x:key= "Buttonfocusvisual" >
<setter property= "Control.template" >
<Setter.Value>
<ControlTemplate>
<rectangle stroke= "Black" strokedasharray= "1 2" strokethickness= "1" margin= "2" snapstodevicepixels= "true"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<lineargradientbrush x:key= "Buttonnormalbackground" endpoint= "0,1" startpoint= "0,0" >
<gradientstop color= "#F3F3F3" offset= "0"/>
<gradientstop color= "#EBEBEB" offset= "0.5"/>
<gradientstop color= "#DDDDDD" offset= "0.5"/>
<gradientstop color= "#CDCDCD" offset= "1"/>
</LinearGradientBrush>
<solidcolorbrush x:key= "Buttonnormalborder" color= "#FF707070"/>
<style x:key= "ButtonStyle1" targettype= "{x:type button}" >
<setter property= "FocusVisualStyle" value= "{StaticResource buttonfocusvisual}"/>
<setter property= "Background" value= "{StaticResource buttonnormalbackground}"/>
<setter property= "BorderBrush" value= "{StaticResource buttonnormalborder}"/>
<setter property= "BorderThickness" value= "1"/>
<setter property= "Foreground" value= "{dynamicresource {x:static Systemcolors.controltextbrushkey}}"/>
<setter property= "horizontalcontentalignment" value= "Center"/>
<setter property= "verticalcontentalignment" value= "Center"/>
<setter property= "Padding" value= "1"/>
<setter property= "Template" >
<Setter.Value>
<controltemplate targettype= "{x:type button}" >
<microsoft_windows_themes:buttonchrome x:name= "Chrome" snapstodevicepixels= "true" background= "{TemplateBinding Background} "borderbrush=" {TemplateBinding BorderBrush} "renderdefaulted=" {TemplateBinding isdefaulted} " Rendermouseover= "{TemplateBinding ismouseover}" renderpressed= "{TemplateBinding ispressed}" >
<contentpresenter horizontalalignment= "{TemplateBinding horizontalcontentalignment}" margin= "{TemplateBinding Padding} "verticalalignment=" {TemplateBinding verticalcontentalignment} "snapstodevicepixels=" {TemplateBinding Snapstodevicepixels} "recognizesaccesskey=" True "/>
</Microsoft_Windows_Themes:ButtonChrome>
<ControlTemplate.Triggers>
<trigger property= "iskeyboardfocused" value= "true" >
<setter property= "renderdefaulted" targetname= "Chrome" value= "true"/>
</Trigger>
<trigger property= "togglebutton.ischecked" value= "true" >
<setter property= "renderpressed" targetname= "Chrome" value= "true"/>
</Trigger>
<trigger property= "IsEnabled" value= "false" >
<setter property= "Foreground" value= "#ADADAD"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>

WPF Button Style Original template

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.