Click here to Skip to main content
15,900,816 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have a created control in code behind and would like to add a Grid element. How this can be done!
Leung Yat Chun 22-Dec-13 14:18pm    
I don't know how to do it without using xaml, but I think you can inherited from ContentControl instead.
public class Control1 : ContentControl
{ public override void OnApplyTemplate() { base.OnApplyTemplate(); Content = new Grid(); } }

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900