Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Can you make a treeview behave like a tabcontrol?

Can you make a treeview behave like a tabcontrol?

Scheduled Pinned Locked Moved WPF
csharpwpftutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bfis108137
    wrote on last edited by
    #1

    I have an application where I would like a treeview to behave like a tabcontrol. What I mean is that when the user clicks on a item in the treeview, to the right would appear something sort of like what you might see in Outlook. I am trying to avoid a tabcontrol simply because there will be lot's of tabs and the items have a hierarchy to them. For example There will be companies with adresses. Each company could have multiple addresses and I would like to have a treeview item of "addresses" and then each address will have a nickname like "main address" or "billing address" and I would like for the user to be able to click on this and then see it to the right. I was thinking of maybe using multiple grids and then showing and hiding but seems that that's not in the spirit of wpf and I don't know if it will even work.

    I 1 Reply Last reply
    0
    • B bfis108137

      I have an application where I would like a treeview to behave like a tabcontrol. What I mean is that when the user clicks on a item in the treeview, to the right would appear something sort of like what you might see in Outlook. I am trying to avoid a tabcontrol simply because there will be lot's of tabs and the items have a hierarchy to them. For example There will be companies with adresses. Each company could have multiple addresses and I would like to have a treeview item of "addresses" and then each address will have a nickname like "main address" or "billing address" and I would like for the user to be able to click on this and then see it to the right. I was thinking of maybe using multiple grids and then showing and hiding but seems that that's not in the spirit of wpf and I don't know if it will even work.

      I Offline
      I Offline
      Ian Shlasko
      wrote on last edited by
      #2

      I do something like this in one of my applications... There are several ways to go about this, but I do mine with a DataTemplateSelector. Basically, my content pane is just a ContentControl (Actually, I think I'm using a Label, but I forget why), with its content bound to the selected item in the tree. The DataTemplateSelector looks at the data object being displayed, and chooses which DataTemplate to use to display it (I have one for each type of item in the tree). The individual DataTemplates are just resources with standard names, so the selector code is just returning FindResource("DT_Something") as DataTemplate

      Proud to have finally moved to the A-Ark. Which one are you in?
      Author of the Guardians Saga (Sci-Fi/Fantasy novels)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups