c# - WPF Transparency and Switching Styles between Transparent and Non-Transparent -
2 questions :
- firstly:
possible toggle transparency on wpf window? pointers appreciated! - secondly:
controls on window inherit transparancy parent window, have datagrid control own style - style in external file reference (style="{dynamicresource mydgstyle}")..... in xaml code behind can switch styles? (ideally achieve using style trigger, don't think can).
thanks much
joe
edit (can't seem reply)
thanks alex, nvm
regarding toggling transparency, long can set 'background' property of window @ runtime color 'transparent' @ runtime, thats fine.
regarding switching styles, extending code alex, presumably can
void onbuttonpress() { var transparentstyle = themes.currenttheme.mydgnontransparentstyle; var nontransparentstyle = themes.currenttheme.mydgnontransparentstyle; if (istransparent) // change non-transparent this.mygrid.style = (style)this.findresource(nontransparentstyle); else // change transparent this.mygrid.style = (style)this.findresource(nontransparentstyle); }
?
thanks
joe
3rd edit
thanks guys,
sorry confuse - second question since datagrid has own style (and doesn't inherit window) need set style depending on current state (transparent / non-ransparent) - need change datagrid style @ runtime - since can done window, can assume can done datagrid?
thanks
joe
is possible toggle transparency on wpf window?
yes, is:
<window windowstyle="none" allowstransparency="true" background="#88aa3366"> </window/>
the bad news have implement logic of window header yourself. this article might helpfull.
in xaml code behind can switch styles?
the question little bit unclear, maybe helps:
var key = themes.currenttheme.mydgstyle; this.mygrid.style = (style)this.findresource(key);
Comments
Post a Comment