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

  • Home
  • SEARCH
  • 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 915179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:50:37+00:00 2026-05-15T17:50:37+00:00

I am constructing my app infra structure, and finding it hard to achieve a

  • 0

I am constructing my app infra structure, and finding it hard to achieve a very basic behavior – I want to raise events from different user controls in the system and being able to catch those events on some other user controls that listens to them. For example i have a user control that implements a TreeView. I have another user control that implmements a ListView. Now, i want my ListView to listen to the TreeView, and when the selection is changed on the TreeView, i want to repopulate my ListView accordingly.
I also want this to happen even if the ListView is not located within the TreeView on the WPF logical tree.

PLEASE HELP!!

Thanks,
Oran

  • 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-15T17:50:38+00:00Added an answer on May 15, 2026 at 5:50 pm

    Use data binding.

    If the content of the list view is stored inside the object shown in the tree view you can just bind into the tree SelectedItem property.

    Otherwise bind the tree SelectedItem to a property in your view models (or your window!) and in the setter of this property change the list that is bound to the list view ItemSource property.

    You can see the technique in this series on my blog the post I linked to is the last post with the code download link, you’ll need to read from the beginning of the series if you want the full explanation.

    EDIT: Here’s how I did it in one project: (the GridView definition removed since it’s not relevant here)

        <TreeView 
            Name="FolderTree" 
            Width="300" 
            ItemsSource="{Binding Root.SubFolders}"
            ItemTemplate="{StaticResource FolderTemplate}"/>
        <ListView 
            Name="FileView"
            ItemsSource="{Binding ElementName=FolderTree, Path=SelectedItem.Files}">
        </ListView>
    

    The list bound into the tree view’s ItemsSource is of objects that have 3 properties: Name (that is bound to a TextBlock in the FolderTemplate), SubFolders (that is likewise bound to the HierarchicalDataTemplate.ItemsSource property) and Files that is bound to the ListView using {Binding ElementName=FolderTree, Path=SelectedItem.Files}

    Note that non of the lists are observable collections (because in this project they never change) but are loaded lazily (on-demand) by the properties getters (because in this project they are expensive to load).

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

Sidebar

Related Questions

Window app i am constructing is for very low end machines (Celeron with max
I'm constructing an internal instance messager app which is very similar to whatapps. Can
I am constructing a task app ( For fun) & i just sat down
I have a Rails app that allows users to build up a network structure
I am creating a new settings screen for my app and want to keep
i'm pretty new to xcode and i'm using xcode4, constructing an app with the
I am constructing a tuning fork app. The fork should allow up to 12
I am constructing an application and planning to use C2DM with app engine running
I've just spent numerous hours constructing an icon for an Android app I'm working
My iPad app features a UITableView populated from a feed. Like most RSS readers,

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.