diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-05-10 08:51:34 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-05-10 08:51:34 +0300 |
| commit | 30b9452d7d554b26ac78746cf6ad0a290b0a4ed3 (patch) | |
| tree | 17740105e662a6b7f1f2c23b23e9f6021822fc39 /Software/Visual_Studio/Tango.SharedUI/Controls | |
| parent | 5217f784963202cdf07b05930f17ced91d423652 (diff) | |
| download | Tango-30b9452d7d554b26ac78746cf6ad0a290b0a4ed3.tar.gz Tango-30b9452d7d554b26ac78746cf6ad0a290b0a4ed3.zip | |
Implemented MS color capture emulator.
Working on TCC...
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI/Controls')
| -rw-r--r-- | Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs index 1ec273e43..b3869daff 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/NavigationControl.cs @@ -233,6 +233,16 @@ namespace Tango.SharedUI.Controls public static readonly DependencyProperty SelectedIndexProperty = DependencyProperty.Register("SelectedIndex", typeof(int), typeof(NavigationControl), new PropertyMetadata(0, (d, e) => (d as NavigationControl).OnSelectedIndexChanged())); + public bool UseDefferedRendering + { + get { return (bool)GetValue(UseDefferedRenderingProperty); } + set { SetValue(UseDefferedRenderingProperty, value); } + } + public static readonly DependencyProperty UseDefferedRenderingProperty = + DependencyProperty.Register("UseDefferedRendering", typeof(bool), typeof(NavigationControl), new PropertyMetadata(false)); + + + private void OnSelectedIndexChanged() { SelectedElement = Elements[SelectedIndex > Elements.Count - 1 ? 0 : SelectedIndex]; @@ -342,34 +352,47 @@ namespace Tango.SharedUI.Controls toRemove.ForEach(x => _grid.Children.Remove(x)); - foreach (var x in toAdd) + if (UseDefferedRendering) { - var navigationElement = new NavigationElement() + foreach (var x in toAdd) { - RenderTransformOrigin = new Point(0.5, 0.5), - Element = x, - Content = x, - }; - - _grid.Children.Add(navigationElement); + var navigationElement = new NavigationElement() + { + RenderTransformOrigin = new Point(0.5, 0.5), + Element = x, + Content = x, + }; - if (!KeepElementsAttached) - { - bool loaded = false; + _grid.Children.Add(navigationElement); - navigationElement.Loaded += (_, __) => + if (!KeepElementsAttached) { - if (!loaded) + bool loaded = false; + + navigationElement.Loaded += (_, __) => { - if (x != SelectedElement) + if (!loaded) { - loaded = true; - navigationElement.Content = null; + if (x != SelectedElement) + { + loaded = true; + navigationElement.Content = null; + } } - } - }; + }; + } } } + else + { + toAdd.ForEach(x => _grid.Children.Add( + new NavigationElement() + { + RenderTransformOrigin = new Point(0.5, 0.5), + Element = x, + Content = KeepElementsAttached ? x : null, + })); + } } if (!Elements.Contains(SelectedElement)) |
