Results 1 to 7 of 7

Thread: Tab Item Question

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Location
    Milan
    Posts
    810

    Tab Item Question

    How can I make the content of my tabitem a copy of another class in my solution?

  2. #2
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Tab Item Question

    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.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Location
    Milan
    Posts
    810

    Re: Tab Item Question

    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.

  4. #4
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Tab Item Question

    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
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Location
    Milan
    Posts
    810

    Re: Tab Item Question

    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
    Last edited by AirlineSim; May 28th, 2010 at 07:34 PM.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Location
    Milan
    Posts
    810

    Re: Tab Item Question

    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?

  7. #7
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Tab Item Question

    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.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width