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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:37:40+00:00 2026-05-12T22:37:40+00:00

I’m learning WPF and MVVM and trying to stress good design. I have lots

  • 0

I’m learning WPF and MVVM and trying to stress good design. I have lots of experience with WinForms and C#. This is conceptual so I don’t think I need to post code.

I have a xaml Window that manages “Profiles”. On the left half is a custom Control treeview bound to a ViewModel that reads a database and creates a heirarchy of profiles. The ViewModel for the individual profiles contains a database ID among other things. The right half is another custom control with a ListView and its own ViewModel that reads the database for individual Profile information.

Both halves work fine independently, but now I want to tie the treeview selection with the listview so that the information in the listview reflects the treeview selection. What is the best way to do this?

The treeview viewmodel provides a profile ID that can be used to lookup profile information in the listview. Again, the goal is to just to tie these two together. I feel like I have a few options:

-The treeview’s viewmodel could call a static method in the listview viewmodel that updates the profile.

-The whole page could contain a viewmodel that has member viewmodels for both components.

-I could somehow “route” the treeviewss viewmodel’s known selected profile to the listview control in the xaml file.

All of these options feel dirty. Again I’m learning here, and want to stress good design as these little details dictate larger decisions later on.

And ideas?

Thanks!

  • 1 1 Answer
  • 2 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-12T22:37:40+00:00Added an answer on May 12, 2026 at 10:37 pm

    Are you using Prism? CAL WPF? If so you might want to consider using Composite Events. These are events that work across ViewModels, there are also CompositeCommands.

    You can set up a composite event like so …

    public class ProfileSelectedEvent : CompositePresentationEvent<Profile>
    {
    }
    

    You can then use the EventAggregator to subscribe and publish the composite events. If your using Prism/CAL for WPF you’ll have Unity plugged in, so you can just put IEventAggregator in the constructor of your ViewModel

    TreeViewViewModel(IEventAggregator eventAggregator)
    

    Then you can publish and subscribe to the Event via the EventAggregator …

    EventAggregator.GetEvent<ProfileSelectedEvent>().Publish(profile);
    

    Subscribe is very similar … I’m sure you get the idea!

    Hope this helps,

    Andy

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.