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. Treeview in expander

Treeview in expander

Scheduled Pinned Locked Moved WPF
csharpwpfquestion
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.
  • R Offline
    R Offline
    Ravi Mori
    wrote on last edited by
    #1

    Hello, I have a treeview in expander in my wpf project.. I am using hierarchical datatemplate (which have arrow image and textblock) for treeview databinding. I am using style triggers for changing selected node's fonts to bold.. Now upto this all things working fine, but after selecting particular node(either child or parent) when i collapsed my expander control and expand it again, background for textblock will be gray.. Any idea??

    P 1 Reply Last reply
    0
    • R Ravi Mori

      Hello, I have a treeview in expander in my wpf project.. I am using hierarchical datatemplate (which have arrow image and textblock) for treeview databinding. I am using style triggers for changing selected node's fonts to bold.. Now upto this all things working fine, but after selecting particular node(either child or parent) when i collapsed my expander control and expand it again, background for textblock will be gray.. Any idea??

      P Offline
      P Offline
      pc rajesh singh
      wrote on last edited by
      #2

      Last selected Item of treeview control will display the gray color, on expand of expander for the reason it represent disabled selection. Select an item in treeviewcontrol, and then click outside the preview of treeviewcontrol to trigger lost focus of treeviewcontrol, the selected item will be gray. <Style x:Key="TreeViewItemItemTemplateStyle" TargetType="{x:Type TreeViewItem}"> <Style.Resources> <!-- Background of selected item when focussed --> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Blue" /> <!-- Background of selected item when not focussed --> <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="LightGray" /> </Style.Resources> </Style> you can override the gray color by applying the color you want for not focussed style.

      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