Erstellen ControlTemplate programmgesteuert in WPF

Wie kann ich programmgesteuert eine Schaltfläche Vorlage?

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;

Also brauche ich eine Möglichkeit, mein Polygon wie die Schaltfläche Vorlage. Vorschläge?

Dank.

InformationsquelleAutor Thomas Stock | 2010-03-28

Schreibe einen Kommentar