I work with
WPF and not using
MVVM approach. One of the important part of applications is communication among
MVVM they do it behind the scenes and let you use some method to make it possible to send or receive data among different instances.
In code behind, Parent and child windows can communicate easily by just passing or assigning
ParentWindow reference to
ChildWindow. To make communication possible among different windows or pages. But what I've done is,
Created a Static Class named as Operator.cs that has a
List<Window> AvailableWindows . Now every time we create a window, we push this instance into
List<Windows> AvailableWindows and when closing window remove that instance from
AvailableWindows . This way I've reference to available pages or windows and from anywhere i can access it and do whatever and can communicate among many instances easily.
public static class Operator
public static List<Page> AvailablePages = new List<Page>();
public static List<Window> AvailableWindows = new List<Window>();
My question is, if it's a good approach, bad or just Ok ? or any other alternative ?