add controls dyanmically in Control Template
WPF
1
Posts
1
Posters
0
Views
1
Watching
-
I need to add styles for the controls in a panel dynamically, I have created object of the control classes and setted the properties like this
properties.Add(TextBox.FontFamilyProperty, "Arial");
Now I want to add a ControlTemplate similarly, I have created object of ControlTemplate like this
ControlTemplate ctrl = new ControlTemplate(); ctrl.TargetType = typeof(edtPanel); TextBlock txtbl = new TextBlock(); txtbl.Text = "Test Cotnrol Tempalte"; properties.Add(TextBox.TemplateProperty, ctrl);
edtPanel is the panel name where i need to add all the controls Now i want to add the txtbl inside the ControlTemplate ctrl, but I don't have any idea how??? Does anybody help me? Thanks in advance,