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
Post a Comment