diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-05 19:24:36 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-05 19:24:36 +0300 |
| commit | 466b54210bc5066e6e29107d6c8f996f360b1426 (patch) | |
| tree | 287625244cc1a16b59ecce589eb7b506df4c9363 /Software/Visual_Studio/PPC/Tango.PPC.Common/Controls | |
| parent | 2800ef294e92c6181c47ecf5bd556fcb25dc62ce (diff) | |
| download | Tango-466b54210bc5066e6e29107d6c8f996f360b1426.tar.gz Tango-466b54210bc5066e6e29107d6c8f996f360b1426.zip | |
Done some work on color catalog.
Removed manipulation enabled from everywhere!
Implemented "DelayCommand for TouchButton"..
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Controls')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml | 4 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs | 28 |
2 files changed, 25 insertions, 7 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml index 66db7bc10..baf971430 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml @@ -16,11 +16,11 @@ <ColumnDefinition Width="100"/> </Grid.ColumnDefinitions> - <touch:TouchListBox ItemsSource="{Binding Groups}" x:Name="list" DisableRipple="True" ScrollBarVisibility="Collapsed" SelectionMode="None"> + <touch:TouchListBox ItemsSource="{Binding Groups}" x:Name="list" x:FieldModifier="public" DisableRipple="True" ScrollBarVisibility="Collapsed" SelectionMode="None"> <touch:TouchListBox.ItemTemplate> <DataTemplate> <StackPanel Margin="0 0 10 0"> - <TextBlock HorizontalAlignment="Center" Text="{Binding Name}"></TextBlock> + <TextBlock HorizontalAlignment="Center" Text="{Binding Name}" FontSize="{StaticResource TangoTitleFontSize}"></TextBlock> <touch:TouchStaticListBox ItemsSource="{Binding Items}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=SelectedItem,Mode=TwoWay}" Margin="0 20 0 40"> <touch:TouchStaticListBox.ItemsPanel> <ItemsPanelTemplate> 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 024f47f58..f2a90a454 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 @@ -13,6 +13,7 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using Tango.BL.Catalogs; +using Tango.Touch.Controls; namespace Tango.PPC.Common.Controls { @@ -39,14 +40,25 @@ namespace Tango.PPC.Common.Controls InitializeComponent(); Loaded += TwineCatalogControl_Loaded; - DataContextChanged += (x, y) => { _catalog = DataContext as Catalog; }; + DataContextChanged += (x, y) => + { + _catalog = DataContext as Catalog; + + if (list.ScrollViewer != null && _catalog != null) + { + list.ScrollViewer.ScrollToTop(); + _preventChange = true; + slider.Value = _catalog.Groups.Count; + _preventChange = false; + } + }; } private void ScrollViewer_Scrolling(object sender, Touch.Controls.DoubleValueChangedEventArgs e) { if (!_preventChange) { - if (e.Value > _lastScrollPosition + 10 || e.Value < _lastScrollPosition - 10) + if (e.Value > _lastScrollPosition + 60 || e.Value < _lastScrollPosition - 60) { var group = list.ScrollViewer.GetMostVisibleElementDataContext<CatalogGroup>(); @@ -56,9 +68,9 @@ namespace Tango.PPC.Common.Controls slider.Value = slider.Maximum - _catalog.Groups.IndexOf(group); _preventChange = false; } - } - _lastScrollPosition = e.Value; + _lastScrollPosition = e.Value; + } } } @@ -89,7 +101,7 @@ namespace Tango.PPC.Common.Controls } } - if (_catalog != null) + if (_catalog != null && _catalog.Groups.Count > _catalog.Groups.Count - 1 - (int)e.NewValue && _catalog.Groups.Count - 1 - (int)e.NewValue > -1) { slider.Foreground = new SolidColorBrush(_catalog.Groups.ElementAt(_catalog.Groups.Count - 1 - (int)e.NewValue).Color); } @@ -106,5 +118,11 @@ namespace Tango.PPC.Common.Controls _preventChange = false; } } + + public TouchListBox TouchListBox + { + get { return list; } + } + } } |
