Reputation: 457
I am a newbie to C# and WPF in particular and I'm wondering how to create a TabControl programatically(not via xaml). I have the following code:
private void Button_Click_3(object sender, RoutedEventArgs e)
{
TabControl c = new TabControl()
}
But the TabControl is not created when the button is clicked. Could someone please give me a basic example on how to create a TabControl programatically. This may also help me understand how WPF works(I am more used to Swing Java). Many thanks.
Upvotes: 0
Views: 468
Reputation: 887225
You need to add the TabControl
to some part of your window.
Specifically, you should add it to the Children
collection of some kind of panel.
Upvotes: 1