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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. WPF
  4. Binding a panel to the selected item type

Binding a panel to the selected item type

Scheduled Pinned Locked Moved WPF
wpftutorialcsharpcsswcf
2 Posts 2 Posters 7 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.
  • G Offline
    G Offline
    Gian
    wrote on last edited by
    #1

    Hello, i'm studying WPF for quite a while and i've some problems understanding how to perform a simple implementation i usually use in my programs. I've a treeview representing at the various levels different types of items. When i click on an item i can see a form/property grid/etc showing the attributes of that element so i can modify/see them. Of coruse each type of element has different attributes. There's also another situation when you have a list of items and not a treeview, but each item is logically attached to a serie of data (see for example an options dialog when you have the list of categories on the left and on the right the options of the selected category) I'm thinking about two ways to do that and i'd like your opinions: 1) Assign a window (or i presume, an user control) to a panel on the fly when the selected item is change. Is it possible? There's a way to do that only via xaml? 2) Load each type of details control via xaml and somehow bind the visibily property of each control to the type of the selected item 3) As you can do a datatemplate to represent each item in the treeview, apply different templates to the panel binded to the selected item of the treeview, using the DataType property of the template to bind the correct panel to the current item type. Is it possible? Is there any example of that? Thanks :)

    G 1 Reply Last reply
    0
    • G Gian

      Hello, i'm studying WPF for quite a while and i've some problems understanding how to perform a simple implementation i usually use in my programs. I've a treeview representing at the various levels different types of items. When i click on an item i can see a form/property grid/etc showing the attributes of that element so i can modify/see them. Of coruse each type of element has different attributes. There's also another situation when you have a list of items and not a treeview, but each item is logically attached to a serie of data (see for example an options dialog when you have the list of categories on the left and on the right the options of the selected category) I'm thinking about two ways to do that and i'd like your opinions: 1) Assign a window (or i presume, an user control) to a panel on the fly when the selected item is change. Is it possible? There's a way to do that only via xaml? 2) Load each type of details control via xaml and somehow bind the visibily property of each control to the type of the selected item 3) As you can do a datatemplate to represent each item in the treeview, apply different templates to the panel binded to the selected item of the treeview, using the DataType property of the template to bind the correct panel to the current item type. Is it possible? Is there any example of that? Thanks :)

      G Offline
      G Offline
      Gideon Engelberth
      wrote on last edited by
      #2

      It sounds to me like you are describing what would normally be done with a tab control. I would start there and style the tab control to get the "tabs" to look how you want. Since TabControl inherits from ItemsControl, any trick you used for other list/tree controls should work there as well. Hopefully some sort of style would work, but if not, you could always write a new control template. If that does not work, I would recommend your option 2. I would use radio buttons (with the template modified to not show the circles) in a stack panel and bind the Visibility of the options "pages" to the IsChecked of the radio button. Since Visibility is not a boolean, this will of course require either a converter or some clever triggers. A little poking around and I got this as something you may be able to start from: Option Group BTN 1 Property 1 ddd Property 2 fff

      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