我想在c#代码中为按钮添加转角半径。当我跑步时,所有的屁股都消失了。欢迎任何帮助或提示
Style s = new Style(typeof(Button));
ControlTemplate control = new ControlTemplate(typeof(Button));
control.VisualTree = new FrameworkElementFactory(typeof(Border));
control.VisualTree.SetValue(Border.CornerRadiusProperty, new CornerRadius(10));
s.Setters.Add(new Setter(Button.TemplateProperty,control));
答案 0 :(得分:0)
尝试将ContentPresenter添加到边框:
elemFactory.AppendChild(new FrameworkElementFactory(typeof (ContentPresenter)));