c# - Change background on mouse over for default button -
in wpf application want change background
of button
on mouseover
. triggers isdefault
, ismouseover
adjusted. possible define separate trigger reacts on both of isdefault
, ismouseover
triggers.
<controltemplate.triggers> <trigger property="isdefault" value="true"> <setter property="background" value="#1ba1e2" /> </trigger> <trigger property="ismouseover" value="true"> <setter property="background" value="#9a9ea1" /> </trigger> <trigger ??? property="isdefault" value="true" && property="ismouseover" value="true" /> <setter property="background" value="#9a9e88"/> </trigger> </controltemplate.triggers>
you can use multitrigger , example of multi trigger in wpf. this:
<window.resources> <style x:key="multi" targettype="{x:type button}" > <style.triggers> <multitrigger> <multitrigger.conditions> <condition property="isdefault" value="true"></condition> <condition property="ismouseover" value="true"></condition> </multitrigger.conditions> <multitrigger.setters> <setter property="background" value="white" ></setter> </multitrigger.setters> </multitrigger> </style.triggers> </style> </window.resources> <grid> <button style="{staticresource multi}"></button> </grid>
Comments
Post a Comment