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 6375511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:37:29+00:00 2026-05-25T01:37:29+00:00

Possible Duplicate: WPF TreeView – How to scroll so expanded branch is visible I’m

  • 0

Possible Duplicate:
WPF TreeView – How to scroll so expanded branch is visible

I’m developing an application that utilizes the standard TreeView functionality in WPF. I’ve created a search function within the TreeView that will parse through the tree and locate a matching title (e.g. “Create” will work for finding a TreeViewItem titled “Create a Project:”. If I press the “enter” key while the search textbox still has focus, it’ll parse through the tree for the next possible TreeViewItem. The search functionality is inspired by the code found here at Josh Smith’s TreeView Article, but modified slightly to work within the resources of my application and its nodes (the trees generated are dynamic, depending on the files imported in the application, and I obviously have my own Object classes).

When I tried to look up this issue, I found a million and one search hits for how to set the SelectedItem for the TreeView (which I’m not having an issue with), but I couldn’t find anything specifically for my problem which is this: Every time I do a search, the tree will find the SelectedItem (if it exists), and call IsExpanded = true to all the elements recursively up to the root of the tree. But sometimes the element discovered is outside of the visual frame of the TreeView (I have scrollbars set to auto, so when the tree grows too large horizontally or vertically, scroll bars are enabled). The SelectedItem changes appropriately, but I have to scroll down the TreeView in order to find where my match was made. What I’m hoping to do is fire an event that will detect when the SelectedItem is changed, and then force the Visual of the TreeView to show the selected item at some point within its visible frame (so it’s never out of visibility if found), but I’m not sure how exactly to do this (my experience with WPF is limited to the last month or so I’ve spent developing this application, so I’m still new to the language and picking things up as I go along).

Are there any solutions for this? I can provide code if desired, but I’m just looking for somebody to point me in the right direction on how to change the visible region of my TreeView item.

  • 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-25T01:37:30+00:00Added an answer on May 25, 2026 at 1:37 am

    You need to call BringIntoView on the selected TreeViewItem. To not pollute your ViewModel with this code, you could create an Attached Property that calls this method when it is set to true and bind it to the IsSelected property.

    Another way is to use a trigger on the IsSelected property to call this method as shown here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: What is the difference between WPF and Silverlight application? What are the
Possible Duplicate: How can one host Flash content in a WPF application and use
Possible Duplicate: WPF MessageBox window style For some reason the MessageBox that comes with
Possible Duplicate: Create WPF TextBox that accepts only numbers How i can check if
Possible Duplicate: How can a WPF application be launched before I logon to Windows?
Possible Duplicate: In WPF, what are the differences between the x:Name and Name attributes?
Possible Duplicate: What WPF books would you recommend? GUI's written using WPF seem to
Possible Duplicate: Drag WPF Popup control I created a WPF popup control in my
Possible Duplicate: XAML Conditional Compilation I am new to WPF. I just need to
Possible Duplicate: WPF Applications: Visual Studio vs. Expression Blend I was starting to learn

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.