Wpf - Edit Resource in run time -


i have xaml:

 <grid x:name="root">     <grid.resources>         <style x:key="btnstyle">             <setter property="button.background" value="lightblue"/>         </style>     </grid.resources>     <button style="{dynamicresource btnstyle}"></button> </grid> 

and question how can change btnstyle setter value red code behind?

this direct answer question:

var style = (style) this.root.findresource("btnstyle"); style.setters.item[0].value = brushes.red; 

but trying accomplish exactly?


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? -