diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-16 15:59:12 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-16 15:59:12 +0300 |
| commit | 04fd2234090e23ff2e648d997a1cc753c9354941 (patch) | |
| tree | 5624cfac25a0439ad6dfaae64132fbe5b62a50a0 /Software/Visual_Studio/Tango.SharedUI/Controls | |
| parent | 9dbb8f8eb3d07ee07cf7ce1beab72df056e157c6 (diff) | |
| download | Tango-04fd2234090e23ff2e648d997a1cc753c9354941.tar.gz Tango-04fd2234090e23ff2e648d997a1cc753c9354941.zip | |
Implemented full machine setup with connectivity and communication testing!
Fixed an issue with auto reset event on transport and logging :/
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI/Controls')
| -rw-r--r-- | Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs index 2b59bb663..c8b6d3afb 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs @@ -17,6 +17,8 @@ namespace Tango.SharedUI.Controls [ContentProperty(nameof(Elements))] public class NavigationControl : UserControl { + private Action _onCompleted; + #region Transition Types public enum TransitionTypes @@ -218,6 +220,22 @@ namespace Tango.SharedUI.Controls DependencyProperty.Register("KeepElementsAttached", typeof(bool), typeof(NavigationControl), new PropertyMetadata(false)); + + public int SelectedIndex + { + get { return (int)GetValue(SelectedIndexProperty); } + set { SetValue(SelectedIndexProperty, value); } + } + + // Using a DependencyProperty as the backing store for SelectedIndex. This enables animation, styling, binding, etc... + public static readonly DependencyProperty SelectedIndexProperty = + DependencyProperty.Register("SelectedIndex", typeof(int), typeof(NavigationControl), new PropertyMetadata(0, (d, e) => (d as NavigationControl).OnSelectedIndexChanged())); + + private void OnSelectedIndexChanged() + { + SelectedElement = Elements[SelectedIndex > Elements.Count - 1 ? 0 : SelectedIndex]; + } + #endregion #region Attached Properties @@ -373,6 +391,8 @@ namespace Tango.SharedUI.Controls if (fromVM != null && fromVM != toVM) fromVM.OnNavigatedFrom(); if (toVM != null) toVM.OnNavigatedTo(); + + _onCompleted?.Invoke(); }; switch (TransitionType) @@ -478,6 +498,13 @@ namespace Tango.SharedUI.Controls public FrameworkElement NavigateTo(String navigationName) { + return NavigateTo(navigationName, null); + } + + public FrameworkElement NavigateTo(String navigationName, Action onCompleted = null) + { + _onCompleted = onCompleted; + var element = Elements.SingleOrDefault(x => GetNavigationName(x) == navigationName || x.GetType().Name == navigationName); if (element != null) |
