在前台,我们可以通过语句
Style="{StaticResource btnStyle}"
来绑定样式,在后台中对应的语句是:
ButtonTest.Style = App.Current.Resources["btnStyle"] as Style;
或者:
ButtonTest.Style
=
System.Windows.Application.Current.Resources[
"
btnStyle
"
]
as
Style;
转载于:https://www.cnblogs.com/ManMonth/archive/2011/09/01/2161568.html