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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:27:30+00:00 2026-05-27T14:27:30+00:00

I have a WPF app that uses a business object called Visit, it has

  • 0

I have a WPF app that uses a business object called Visit, it has a lot of child objects like patient, exam, and others. There are views and view models for editing these various child objects, so there is a view and view model for editing patient info and one set for exam info, etc. There is also a main window view model.

When I need to open a new Visit, I have a search screen that also has it’s own view model. It needs to open new visit from the database and notify all the other views that the visit has changed.

I’ve looked into WeakEventManager, and also having one view model that is the parent of all the others, but I’m not sure what is the best way to proceed. I’d like to know what the relationship between the view models should be and how the open/search view model should tell all the other views to update. I have been calling OnPropertyChanged(“propname”) in my view models when a property is updated, but since the other views don’t know about the open/search view model, they don’t care if I say OnPropertyChanged(“Visit”)

  • 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-27T14:27:31+00:00Added an answer on May 27, 2026 at 2:27 pm

    Have a look at this post on SO that talks about the Messenger. In your case you case post the Visit object and have the ViewModel capture that for display.

    If you have a very data centric views where the Model data is pretty much presented directly on the View without a lot of modification you can easily expose the Model as a property on the ViewModel and have the View bind to its properties.

    This way when one View updates the Model the other View‘s will update automatically without having to listen for property change events on the Model

    Edit:

    To elaborate on my second point: You may or may not need this but if your Model also implements INotifyPropertyChanged then any changes to that model will be propagated to the View automatically.

    If you need to have 2 Views with the Visit object then you can have the Visit property directly bound in XAML

    public class ViewModel1 : ViewModelBase
    {
       public ViewModel1(IMessenger messenger)
       {
           messenger.Register<Visit>(this, (v) => CurrentVisit = v);
       }
    
       public Visit CurrentVisit
       {
          get { _visit; }
          set { _visit = value; RaiseNotifyPropertyChange("CurrentVisit"); }
       }
    }
    
    public class ViewModel2: ViewModelBase
    { 
       public ViewModel2(IMessenger messenger)
       {
           messenger.Register<Visit>(this, (v) => CurrentVisit = v);
       }
    
       public Visit CurrentVisit
       {
          get { _visit; }
          set { _visit = value; RaiseNotifyPropertyChange("CurrentVisit"); }
       }
    }
    
    public class CurrentVisit : INotifyPropertyChanged
    { ... }
    

    Like I said this is only applicable if you need the same Visit object shared amounst 2 or more ViewModels and if the View‘s mostly are data centric or in other words the data from the Model is being presented directly on the screen. This is to avoid duplicating the properties in the ViewModels and having to raise the property change event all the time.

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

Sidebar

Related Questions

This is an interesting conundrum. We have a WPF app that has a Vista-like
Context: I have a WPF App that uses certain unmanaged DLLs in the D:\WordAutomation\MyApp_Source\Executables\MyApp
I have a WPF App that implements a ListView. I would like to show
I have a folder in my WPF app Images that has several .png files
I have a Windows Forms app, that has a single ElementHost containing a WPF
I'm a complete beginner in WPF and have an app that uses StoryBoard to
I have a WPF app that uses DispatcherTimer to update a clock tick. However,
I have a WPF app that has a ListBox . The drag mechanism is
I have a wpf app that uses a wcf webservice. Its my webservice and
I have a WPF app that uses a non-WPF vendor library. My app does

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.