WPF CheckBox Style

Source: Internet
Author: User

<style x:key= "focusvisual" > <setter property= "control.template" > <Setter.Value> <ControlTemplate> <rectangle margin= "2" snapstodevicepixels= "true" stroke= "{Dynamicre SOURCE {x:static Systemcolors.controltextbrushkey}} "strokethickness=" 1 "strokedasharray=" 1 2 "/> </Co ntroltemplate> </Setter.Value> </Setter> </Style> <solidcolorbrush x:key= " OptionMark.Static.Background "color=" #FFFFFFFF "/> <solidcolorbrush x:key=" OptionMark.Static.Border "color=" #            FF707070 "/> <style x:key=" optionmarkfocusvisual "> <setter property=" control.template "> <Setter.Value> <ControlTemplate> <rectangle margin= "14,0,0,0" Snapstodev Icepixels= "true" stroke= "{dynamicresource {x:static Systemcolors.controltextbrushkey}}" strokethickness= "1" strokedasharray= "1 2"/> </controltemplate> </Setter.Value> </Setter> </Style> <solidcolorbrush x : key= "OptionMark.MouseOver.Background" color= "#FFF3F9FF"/> <solidcolorbrush x:key= " OptionMark.MouseOver.Border "color=" #FF5593FF "/> <solidcolorbrush x:key=" OptionMark.MouseOver.Glyph [color=] #FF212121 "/> <solidcolorbrush x:key=" OptionMark.Disabled.Background "color=" #FFE6E6E6 "/> < SolidColorBrush x:key= "OptionMark.Disabled.Border" color= "#FFBCBCBC"/> <solidcolorbrush x:key= " OptionMark.Disabled.Glyph "color=" #FF707070 "/> <solidcolorbrush x:key=" OptionMark.Pressed.Background "color= "#FFD9ECFF"/> <solidcolorbrush x:key= "OptionMark.Pressed.Border" color= "#FF3C77DD"/> <solidcolorbrush x : key= "OptionMark.Pressed.Glyph" color= "#FF212121"/> <solidcolorbrush x:key= "OptionMark.Static.Glyph" color= " #FF212121 "/> <style x:key=" Mycheckstyle "targettype=" {x:type CheckBox} "> <setter property= "Effect" > <Setter.Value> <dropshadoweffect shadowdepth= "0" color= "Gra Y "opacity=" 1 "blurradius="/> </Setter.Value> </Setter> <setter Pr Operty= "FocusVisualStyle" value= "{StaticResource focusvisual}"/> <setter property= "Background" value= "{Static Resource OptionMark.Static.Background} "/> <setter property=" BorderBrush "value=" {StaticResource optionmark.st Atic. Border} "/> <setter property=" Foreground "value=" {dynamicresource {x:static Systemcolors.controltextbrushkey}} "/> <setter property=" borderthickness "value=" 1 "/> <setter property=" Template "> &L T Setter.value> <controltemplate targettype= "{x:type CheckBox}" > <viewbox X:na                            Me= "Viewbox" stretch= "Uniform" > <VisualStateManager.VisualStateGroups> <visuaLstategroup x:name= "Checkstates" > <visualstate x:name= "Indeterminate"/>                                </VisualStateGroup> <visualstategroup x:name= "CommonStates" > <visualstate x:name= "Normal"/> <visualstate x:name= "Mous                                        Eover "> <storyboard repeatbehavior=" Forever "autoreverse=" True "> <doubleanimationusingkeyframes storyboard.targetproperty= "(uielement.rendertransform). (TransformGroup.Children) [2]. (rotatetransform.angle) "Storyboard.targetname=" Ellipse "> <easingdoubleke Yframe keytime= "0" value= "0"/> <easingdoublekeyframe keytime= "0:0:5" Valu                                  E= "/> </DoubleAnimationUsingKeyFrames>"      <objectanimationusingkeyframes storyboard.targetproperty= "(uielement.visibility)" Storyboard.TargetName= " Ellipse "> <discreteobjectkeyframe keytime=" 0 "value=" {x:static Visibility . Visible} "/> <discreteobjectkeyframe keytime=" 0:0:5 "value=" {x:static Visi Bility.                                    Visible} "/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <visualsta                            Te x:name= "Pressed"/> <visualstate x:name= "Disabled"/> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <                            Grid width= "height=" x:name= "Templateroot" background= "Transparent" snapstodevicepixels= "True" > <ellipse x: "Ellipse" visibility= "Hidden" height= "Name=" width= "3" stroke= "Green" strokedasharray= "4 4" "Strokethickness=" (Re)                                    ndertransformorigin= "0.5,0.5" > <Ellipse.RenderTransform>                                        <TransformGroup> <ScaleTransform/>                                        <SkewTransform/> <RotateTransform/>                                <TranslateTransform/> </TransformGroup> </Ellipse.RenderTransform> </Ellipse> <b Order X:name= "Border1" height= "width=" "cornerradius=" + "borderthickness=" 1 "background=" White "borderbrush=" Lightgray "> <border x:name=" Border "height=" "width=" [cornerradius=] hickness= "0" borderbrush= "{TempLatebinding BorderBrush} "background=" {TemplateBinding Background} "snapstodevicepixels=" true ">   <contentpresenter margin= "6,5" x:name= "ContentPresenter" focusable= "False" horizontalalignment= "Center" recognizesaccesskey= "True" snapstodevicepixels= "{TemplateBinding snapstodevicepixels}" verticalalignment= "Center" /> </Border> </Border> &lt                        ;/grid> </Viewbox> <ControlTemplate.Triggers>                                <trigger property= "IsChecked" value= "True" > <setter property= "Background" >  <Setter.Value> <lineargradientbrush startpoint= "0.5,0"                                        Endpoint= "0.5,1" > <gradientstop color= "#15b9b9" offset= "0"/> <GradientStop color= "#1e6b87" offset= "1"/> </LinearGradientBrush>                         </Setter.Value> </Setter> </Trigger> <trigger property= "IsChecked" value= "False" > <setter property= "Background" > <Setter.Value> <lineargradien Tbrush startpoint= "0.5,0" endpoint= "0.5,1" > <gradientstop color= "#5a5e6b" Off                                    set= "0"/> <gradientstop color= "#a6abbd" offset= "1"/>                            </LinearGradientBrush> </Setter.Value>                </Setter> </Trigger> </ControlTemplate.Triggers> </controltemplate&Gt </Setter.Value> </Setter> </Style>

  

WPF CheckBox Style

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.