How can I make the content of my tabitem a copy of another class in my solution?
Printable View
How can I make the content of my tabitem a copy of another class in my solution?
You are going to have to explain better and provide an example...
I think you should also point out to people that this is a WPF project and perhaps it should really be in the WPF forum rather than here.
Hi, Thanks I was going to post in the WPF forum but wasn't sure if this related to a WPF funtion or rather just a general tab control issue.
What I have is a code that add's and removes tabs to a tab control.
The main content part of this tab is going to be an instance of a usercontrol.xaml in my solution explorer.
I'm pretty sure you can literally just set the Content property to an instance of your user control
EDIT: e.g:
Code:Dim UsrCtrl As New UserControl1
TabControl1.Items.Add(New TabItem With {.Header = "test"})
DirectCast(TabControl1.Items(0), TabItem).Content = UsrCtrl
Thanks this works
Code:If tabItem Is Nothing Then
tabItem = New TabItem()
tabItem.Header = "Password"
tabItem.Tag = "Pass"
Dim UsrCtrl As New HeaderBar
DirectCast(tabItem, TabItem).Content = UsrCtrl
tabs.Items.Insert(0, tabItem)
tabItem.Focus()
End If
Oh, when it opens it's only as small as it needs to be, i want it to be as big as the tab control.
how can I do this?
I think that will be down to properties you have set on your usercontrol - make sure you are not explicitly setting the Width and Height properties of the user control in XAML.