Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6192679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:59:04+00:00 2026-05-24T02:59:04+00:00

I think my question is rather basic, but I can’t find an answer: I

  • 0

I think my question is rather basic, but I can’t find an answer:
I have a TreeView, and I can’t figure out how to monitor nodes’ selection. I have breakpoints at the handlers for both TreeView.SelectedItemChanged and TreeViewItem.Expanded. When a node is expanded I do see the TreeViewItem.Expanded handler at work, but when clicking on a node, none of those events are fired.
What am I doing wrong?

Thanks.

TreeView code:

    <TreeView Name="TestsTree" Height="Auto" MinHeight="50" ItemsSource="{Binding Path=TreeNodes, Mode=TwoWay}" TreeViewItem.Expanded="TestsTreeExpanded" TreeView.SelectedItemChanged="TestsTreeSelectedItemChanged">
        <TreeView.ItemTemplate>
            <HierarchicalDataTemplate ItemsSource="{Binding Path=TreeNodes, Mode=TwoWay}" DataType="{x:Type TestExplorer:FolderTreeNode}">
                <TreeViewItem Header="{Binding Name}"/>
            </HierarchicalDataTemplate>
        </TreeView.ItemTemplate>
        </TreeView>

Edit:
I’ve tried using TreeViewItem.Selected but it’s the same – when I click on a node’s name there’s no reaction, though when I click at the expansion area, both TreeViewItem.Selected and TreeViewItem.Selected are fired. Any explanation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:59:05+00:00Added an answer on May 24, 2026 at 2:59 am

    You shouldn’t put a TreeViewItem in your DataTemplate. The TreeViewItem is created automatically by the TreeView. The DataTemplate defines the content of the TreeViewItem, not the TreeViewItem itself. Now you have two nested TreeViewItems, which is probably why it doesn’t work as expected. Try that instead:

            <HierarchicalDataTemplate ItemsSource="{Binding Path=TreeNodes, Mode=TwoWay}" DataType="{x:Type TestExplorer:FolderTreeNode}">
                <TextBlock Text="{Binding Name}"/>
            </HierarchicalDataTemplate>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think that I am having a slow evening but I have a question
I think this question is rather easy for you shell scripting monsters. I am
I think the question says it all. I have several monthly processes in stored
I think my question is somewhat similar to CaptainPicard's but dissimilar enough that I
You may think this question is like this question asked on StackOverflow earlier. But
This is a question about style and design rather than syntax. I have domain
This is just a question out of curiosity since I have been needing to
I think the question says it all. I'm new to Eclipse plugin development, so
I think the question is pretty self explanatory. Anyone done this before? UPDATE :
The easiest way to think of my question is to think of a single,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.