WPF button triggers change foregroung label -
i have button
<button grid.row="0" grid.column="0" style="{staticresource botoncreatecampaign}" command="{binding templatelistcommand}" tag="{binding isbuttonactive}" > <grid> <grid.columndefinitions> <columndefinition width="auto" /> <columndefinition width="auto" /> </grid.columndefinitions> <label grid.column="0" content="1." /> <label grid.column="1" content="template" /> </grid> </button>
i have binding in tag button, , change background depending if true or false, ok want when isbuttonactive true, in label => foreground="white" && fontsize="20"
i´m trying this, it´s not working, foreground it´s not changing
<style.resources> <style targettype="label"> <setter property="padding" value="15,15,5,15" /> <style.triggers> <datatrigger binding="{binding relativesource={relativesource mode=self}, path=tag}" value="true"> <setter property="foreground" value="white" /> <setter property="fontsize" value="20" /> </datatrigger> </style.triggers> </style> </style.resources>
this style.
<style x:key="botoncreatecampaign" targettype="{x:type button}"> <setter property="borderthickness" value="0" /> <setter property="background" value="transparent" /> <setter property="template"> <setter.value> <controltemplate targettype="{x:type button}"> <border background="{templatebinding background}" > <contentpresenter /> </border> </controltemplate> </setter.value> </setter> <style.resources> <style targettype="label"> <setter property="padding" value="15,15,5,15" /> <style.triggers> <datatrigger binding="{binding relativesource={relativesource mode=self}, path=tag}" value="true"> <setter property="foreground" value="white" /> <setter property="fontsize" value="20" /> </datatrigger> </style.triggers> </style> </style.resources> <style.triggers> <datatrigger binding="{binding relativesource={relativesource mode=self}, path=tag}" value="true"> <setter property="background" value="orange" /> </datatrigger> <multitrigger> <multitrigger.conditions> <condition property="control.ismouseover" value="true" /> <condition property="tag" value="true" /> </multitrigger.conditions> <setter property="background" value="orange" /> </multitrigger> </style.triggers> </style>
Comments
Post a Comment