aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.SharedUI/Controls
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-06-14 15:57:24 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-06-14 15:57:24 +0300
commita775178c063082eb6a401b4254a046133840af03 (patch)
tree4ba9572da806e6e5ec031853188f6f335546fb57 /Software/Visual_Studio/Tango.SharedUI/Controls
parent099cb04861e293cf675d8b5216448a766eef7954 (diff)
downloadTango-a775178c063082eb6a401b4254a046133840af03.tar.gz
Tango-a775178c063082eb6a401b4254a046133840af03.zip
Working on PPC...
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI/Controls')
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs
index 72e7e50c8..b6f582594 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs
+++ b/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs
@@ -144,6 +144,26 @@ namespace Tango.SharedUI.Controls
#endregion
+ #region INavigationViewModel
+
+ /// <summary>
+ /// Represents a view data context which can be notified when its view is being navigated in or out.
+ /// </summary>
+ public interface INavigationViewModel
+ {
+ /// <summary>
+ /// Called when the navigation system has navigated to this VM view.
+ /// </summary>
+ void OnNavigatedTo();
+
+ /// <summary>
+ /// Called when the navigation system has navigated from this VM view.
+ /// </summary>
+ void OnNavigatedFrom();
+ }
+
+ #endregion
+
private Grid _grid;
private bool _loaded;
@@ -347,6 +367,12 @@ namespace Tango.SharedUI.Controls
{
navigationView.OnNavigated();
}
+
+ INavigationViewModel toVM = toElement.Element.DataContext as INavigationViewModel;
+ INavigationViewModel fromVM = toElement.Element.DataContext as INavigationViewModel;
+
+ if (toVM != null) toVM.OnNavigatedTo();
+ if (fromVM != null && fromVM != toVM) fromVM.OnNavigatedFrom();
};
switch (TransitionType)
@@ -421,6 +447,9 @@ namespace Tango.SharedUI.Controls
{
toElement.Activate();
toElement.Reset();
+
+ INavigationViewModel toVM = toElement.Element.DataContext as INavigationViewModel;
+ if (toVM != null) toVM.OnNavigatedTo();
}
}