【发布时间】:2014-06-21 22:18:45
【问题描述】:
我有这个:
btn.Template = (ControlTemplate)this.FindResource("Temp1");
但我想回到默认模板,怎么做?我试过了:
btn.Template = null
Button b = new Button();
btn.Template = b.Template;
ControlTemplate ct = new ControlTemplate(typeof(Button));
btn.Template = ct;
但是按钮没有出现。
【问题讨论】:
-
当您说“它不起作用”时会发生什么?
-
Just 按钮不出现
-
您不能跨控件移动模板,请参阅我的克隆答案。
-
删除所有这些并使用正确的 XAML。