From 64dde680dcf7cb0c3876aea32134c3324459e94e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 2 Jul 2018 16:42:20 +0300 Subject: Implemented some relief for TwineCatalogControl on scrolling changes.. --- .../Controls/TwineCatalogControl.xaml.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Controls') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs index 2b376e855..d28bbff72 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs @@ -24,6 +24,7 @@ namespace Tango.PPC.Common.Controls private Catalog _catalog; private bool _loaded; private bool _preventChange; + private double _lastScrollPosition = 0; public CatalogItem SelectedItem { @@ -45,14 +46,19 @@ namespace Tango.PPC.Common.Controls { if (!_preventChange) { - var group = list.ScrollViewer.GetMostVisibleElementDataContext(); - - if (group != null) + if (e.Value > _lastScrollPosition + 10 || e.Value < _lastScrollPosition - 10) { - _preventChange = true; - slider.Value = slider.Maximum - _catalog.Groups.IndexOf(group); - _preventChange = false; + var group = list.ScrollViewer.GetMostVisibleElementDataContext(); + + if (group != null) + { + _preventChange = true; + slider.Value = slider.Maximum - _catalog.Groups.IndexOf(group); + _preventChange = false; + } } + + _lastScrollPosition = e.Value; } } -- cgit v1.3.1