Andy Wan
Andy Wan

Reputation: 1100

Windows 8: how to add user control with C# code

I created an user control for my Windows 8 metro style app, I know how to add it to the page with XAML, but how to add it dynamically with C# code?

Upvotes: 1

Views: 2295

Answers (1)

Lukasz Madon
Lukasz Madon

Reputation: 14994

I haven't checked it, but it should be the same as for WPF:

MyUserControl myControl = new MyUserControl();
myPanel.Children.Add(myControl);

Upvotes: 5

Related Questions