WPF - Change label look on mouse over -


i have wpf label , want change on mouse on or hover. question shows how textblock , not quite want using trigger set textblock foreground on mouseover. it's different because label, changing foreground did not work.

using example question linked from, changing word textblock label works fine changing foreground, you'll have provide more information if can't work. try this:

<label content="my colour changes fine" horizontalcontentalignment="center"      verticalcontentalignment="center">     <label.style>         <style targettype="label">             <setter property="foreground" value="blue" />             <style.triggers>                 <trigger property="ismouseover" value="true">                     <setter property="foreground" value="red" />                 </trigger>             </style.triggers>         </style>     </label.style> </label> 

note if set foreground on actual label element, did in answer, instead of in style that stop trigger working, don't this:

<label content="my colour changes fine" horizontalcontentalignment="center"      verticalcontentalignment="center" foreground="black">     <label.style>         <style targettype="label">             <setter property="foreground" value="blue" /> <!-- won't work -->             <style.triggers>                 <trigger property="ismouseover" value="true">                     <setter property="foreground" value="red" /> <!--this won't work-->                 </trigger>             </style.triggers>         </style>     </label.style> </label> 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -