Hello All
I am writing an application where the mainwindow should popup (appear onto the screen) on one event, and then hide (disappear and sit in the system tray) on another event. I am developing in WPF, which do not have built in support for notification icons, so i am using the popular NotifyIcon WPF, as downloaded from internet.
I am also developing using the MVVM design pattern; THis means that I am using one xaml file, called AppEntryPoint, to define a placeholder. Some other code (also a xaml file with its supporting cs) is then assigned to the placeholder. This second xaml file is however not a window, but a resource.
OK. So, My problem is that I am struggling with writing the CLOSE event; If the user clicks on the close button (the normal red X), it should just hide the main window- since there is already an entry in the system tray at that stage.
Upon the next event where it is supposed to become visible again, i need just that to happen.
Problem however is that I do not know where to put the closing event?
The following is my notification icon definition:
<Grid><!--Notification Icon Setup --><tb:TaskbarIcon x:Name="myNotifyIcon" Visibility="Visible" ToolTipText="{ Binding Path=callModel.RecordingStatus, Converter={StaticResource RecordingImageTooltipConverter}, Mode=TwoWay, UpdateSourceTrigger=Explicit}" IconSource="{Binding Path=callModel.RecordingStatus, Converter={StaticResource NotificationIconImageConverter}, Mode=TwoWay, UpdateSourceTrigger=Explicit}" PopupActivation="DoubleClick" MenuActivation="LeftOrRightClick"><tb:TaskbarIcon.ContextMenu><ContextMenu><MenuItem Header="Open" Click="Open_Click"/><MenuItem Header="Close" Click="Close_Click"/></ContextMenu></tb:TaskbarIcon.ContextMenu></tb:TaskbarIcon>
as mentioned before, this code sit in a file that defines a UserControl...
The Window_Closing code is in another xaml section that is used to start the application up, called AppEntryPoint, and at that stage, I do not know about the notification icon. what to do?