Nugget 16: Mediator Pattern in MVVM
Problem As this little experiment of mine slowly turns into a tool I use every day, some design issues are starting to show. Nothing dramatic — just the usual growing pains. In this post, I want to talk about a data‑sharing issue between ViewModels and how the Mediator Pattern helped clean things up. The symptom showed up in the Index view, where a grid lists all Job Applications. Earlier, I added date‑range filtering to that view. It works, but it also made the IndexViewModel a bit “fat.” It’s doing too many things now, and that’s something I’ll need to revisit. When the user filters by date, the grid updates correctly. But then you go to the Home page, where the chart lives, and it still loads the entire dataset. It would make much more sense for the chart to reuse the same FromDate and ToDate and rebuild itself accordingly. That’s where the Mediator Pattern comes in. The Mediator Pattern This pattern is common in MVVM. It lets sibling ViewModels communicate without k...