Hello All.
I am writing a app in C#, WPF. I have the need to control the WindowState programatically, as certain events occur. I already have code that will minimize the window into the system tray, if the close button is clicked, as I do not want the user to close the app. It should wait in the sytem tray, and become active (shown) again, when certain events occur.
Problem is that my code is written according to the MVVM pattern, and this causes the layer which receives the events that I want to act on, not to know about my window class. Anyway, long story short. I've created a singleton, class with a string variable, that will hold the values (Minimized, Normal or Maximized). this class extends INotifyProperty changed, and is invoked from a layer of my code that sits in a common place, where all the different layers can reach it.
I then bind the datacontext to this instance, my binding looks like this:
WindowState="{Binding Path=MyWindowState,Mode=TwoWay}"
It seems that it is not Binding properly, as MyWindowState changes, the OnStateChange event is never executed.
Please help.