在前台,我们可以通过语句

Style="{StaticResource btnStyle}" 

来绑定样式,在后台中对应的语句是:

ButtonTest.Style = App.Current.Resources["btnStyle"as Style;  

或者:

 

ButtonTest.Style = System.Windows.Application.Current.Resources["btnStyle"as Style; 

 

相关文章: