wpf - How to define a default tooltip style for all Controls -


i define style template when there validation errors , display first error message tooltip.

it works fine when targeting specific control datepicker in following xaml.

<style targettype="{x:type toolkit:datepicker}">     <style.triggers>         <trigger property="validation.haserror" value="true">             <setter property="tooltip"                      value="{binding relativesource={relativesource self},                     path=(validation.errors)[0].errorcontent}"/>         </trigger>     </style.triggers> </style> 

i cannot work control though, i.e. following doesn't give tooltip

<style targettype="{x:type toolkit:control}">     <style.triggers>         <trigger property="validation.haserror" value="true">             <setter property="tooltip"                      value="{binding relativesource={relativesource self},                     path=(validation.errors)[0].errorcontent}"/>         </trigger>     </style.triggers> </style> 

any idea?

i recommend create behavior one.

every control unique in , not reliable way attach specific behavior controls. , in fact, may end setting property on unwanted controls don't require validation.

behaviors clean , can assign them selected controls only. attached properties or master behavior can used assign behaviors child controls.

here codeproject article josh smith started on behaviors.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -