wpf - Embed resource list within trigger to apply conditional theme -


so i'm working wpf application first time , have run stumbling block.

i'm working themes third party (actipro) , can set individual properties within theme whatever want so

<style.resources>     <solidcolorbrush   x:key="{x:static themes:assetresourcekeys.expanderheaderbackgroundnormalbrushkey}" color="yellow" /> </style.resources> 

what want do, actually, place declaration inside trigger so

<style.triggers>     <trigger property="ismouseover" value="true">               <solidcolorbrush   x:key="{x:static themes:assetresourcekeys.expanderheaderbackgroundnormalbrushkey}" color="yellow" />     </trigger> </style.triggers> 

but this, of course illegal syntax.

i know can set conditional styles this

<style.triggers>         <trigger property="ismouseover" value="true">                   <setter property="background" value="yellow" />         </trigger> </style.triggers> 

or this

<style.triggers>         <trigger property="ismouseover" value="true">                   <setter property="background" value="{staticresource {x:static themes:assetresourcekeys.expanderheaderbackgroundnormalbrushkey}}" />         </trigger> </style.triggers> 

but sets background color defined resource. that's not i'm after.
need set expanderheaderbackground, not available property setter.

in mind, seem logical able define resources within trigger. apply if condition met. that's not how wpf works.

any 1 know how can achieve this?

you can set resource in style resources not in trigger itself.

<style targettype="control">     <style.resources>         <solidcolorbrush x:key="{x:static themes:assetresourcekeys.expanderheaderbackgroundnormalbrushkey}" color="yellow" />     </style.resources>     <style.triggers>         <trigger property="ismouseover" value="true">             <setter property="background" value="{staticresource themes:assetresourcekeys.expanderheaderbackgroundnormalbrushkey}" />         </trigger>     </style.triggers> </style> 

the trigger not provide specific resources. if want achieve overriding specific resource based on resource key, , depending on ui behavior (like mouseover example) you'll have using code behind.

edit: i'm not familiar actipro, suggest customizing theme overriding resources base on resource keys ? it's not considered practice won't produce reliable results.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -