4
如何以編程方式設置按鈕的模板?以編程方式在WPF中創建ControlTemplate
Polygon buttonPolygon = new Polygon();
buttonPolygon.Points = buttonPointCollection;
buttonPolygon.Stroke = Brushes.Yellow;
buttonPolygon.StrokeThickness = 2;
// create ControlTemplate based on polygon
ControlTemplate template = new ControlTemplate();
template.Childeren.Add(buttonPolygon); // This does not work! What's the right way?
//create button based on controltemplate
Button button = new Button();
button.Template = template;
所以我需要一種方法來設置我的多邊形作爲按鈕的模板。建議?
謝謝。
Yuck。不管怎麼說,還是要謝謝你。 :-) – 2010-03-29 13:37:34