c# - ControlTemplate triggers on ToggleButton -


i trying create style many togglebuttons , need trigger when togglebutton ischecked change button's border red (originally gray when unchecked).

<style x:key="togglebuttonstyle" targettype="{x:type togglebutton}">         <setter property="snapstodevicepixels" value="true" />         <setter property="template">             <setter.value>                 <controltemplate targettype="{x:type togglebutton}">                     <border borderthickness="3"                             cornerradius="4" background="{templatebinding background}">                             <label content="{templatebinding content}" fontfamily="../../fonts/#pokemon pixel font" horizontalalignment="center" verticalalignment="center"></label>                            </border>                     <controltemplate.triggers>                         <trigger property="togglebutton.ischecked" value="true">                             <setter property="fontsize" value="25"/>                             <setter property="togglebutton.borderbrush" value="red"/>                         </trigger>                         <trigger property="togglebutton.ischecked" value="false">                             <setter property="fontsize" value="20"/>                             <setter property="togglebutton.borderbrush" value="gray"/>                         </trigger>                     </controltemplate.triggers>                 </controltemplate>             </setter.value>                    </setter>     </style> 

the fontsize change (larger font size when ischecked) works, button's borderbrush isn't; no border shows @ all, not gray border when togglebutton unchecked. doing wrong here? thank in advance!

change this,

<style x:key="togglebuttonstyle" targettype="{x:type togglebutton}">     <setter property="snapstodevicepixels" value="true" />     <setter property="template">         <setter.value>             <controltemplate targettype="{x:type togglebutton}">                 <border x:name="border" borderthickness="3"                         cornerradius="4" background="{templatebinding background}">                         <label content="{templatebinding content}" fontfamily="../../fonts/#pokemon pixel font" horizontalalignment="center" verticalalignment="center"></label>                        </border>                 <controltemplate.triggers>                     <trigger property="togglebutton.ischecked" value="true">                         <setter property="fontsize" value="25"/>                         <setter property="togglebutton.borderbrush" value="red"/>                     </trigger>                     <trigger property="togglebutton.ischecked" value="false">                         <setter property="fontsize" value="20"/>                         <setter targetname="border" property="border.borderbrush" value="gray"/>                     </trigger>                 </controltemplate.triggers>             </controltemplate>         </setter.value>                </setter> </style> 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -