从模版中找到控件的方法和找到样式的方法

this.Style = (Style) App.Current.Resources["BaseWindowStyle"];

运行下段代码一定要加载样式完成后

i最好是在 Loaded 事件运行完成后加载  

ControlTemplate baseWindowTemplate = (ControlTemplate)App.Current.Resources["BaseWindowControlTemplate"];

Button minBtn = (Button)baseWindowTemplate.FindName("btnMin", this);
minBtn.Click += delegate
{
this.WindowState = WindowState.Minimized;
};

posted @ 2015-01-17 23:10  玖彩技术团队  阅读(163)  评论(0编辑  收藏  举报
以上只是个人想法和实践经验,如果有文字错误和语法错误,请加以指点! QQ:247039968 emil:wujc@younger.com 无论是美女的歌声,还是鬣狗的狂吠,无论是鳄鱼的眼泪,还是恶狼的嚎叫,都不会使我动摇