diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-01 20:21:40 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-01 20:21:40 +0300 |
| commit | 6735203163f95e9210c63a506d30894b4622f301 (patch) | |
| tree | 384eec973d7fe03381b83e3a1ca3322fd575ec66 /Software/Visual_Studio/PPC/Tango.PPC.Common/Controls | |
| parent | 9abee60d7f07068c5f07c3e44f7aa1e8049d97ef (diff) | |
| download | Tango-6735203163f95e9210c63a506d30894b4622f301.tar.gz Tango-6735203163f95e9210c63a506d30894b4622f301.zip | |
Working on twine color catalog.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Controls')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml | 94 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs | 46 |
2 files changed, 140 insertions, 0 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 new file mode 100644 index 000000000..142e1a10c --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml @@ -0,0 +1,94 @@ +<UserControl x:Class="Tango.PPC.Common.Controls.TwineCatalogControl" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="clr-namespace:Tango.PPC.Common.Controls" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:catalog="clr-namespace:Tango.BL.Catalogs;assembly=Tango.BL" + mc:Ignorable="d" + d:DesignHeight="300" Background="White" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=catalog:Catalog, IsDesignTimeCreatable=False}"> + + <Grid> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="100"/> + </Grid.ColumnDefinitions> + + <touch:TouchListBox ItemsSource="{Binding Groups}" x:Name="list"> + <touch:TouchListBox.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock HorizontalAlignment="Center" Text="{Binding Name}"></TextBlock> + <ItemsControl ItemsSource="{Binding Items}" Margin="0 20 0 40"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <WrapPanel Orientation="Horizontal" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Margin="10"> + <Ellipse Width="60" Height="60" Fill="{Binding Brush}" /> + <TextBlock Margin="0 5 0 0" HorizontalAlignment="Center" Text="{Binding Name}"></TextBlock> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </StackPanel> + </DataTemplate> + </touch:TouchListBox.ItemTemplate> + </touch:TouchListBox> + + <Grid Grid.Column="1"> + <Rectangle Stroke="{StaticResource TangoDividerBrush}" HorizontalAlignment="Left" /> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition/> + <ColumnDefinition/> + </Grid.ColumnDefinitions> + + <Border Width="25" CornerRadius="10"> + <Border.Clip> + <RectangleGeometry RadiusX="10" RadiusY="10"> + <RectangleGeometry.Rect> + <MultiBinding Converter="{StaticResource WidthHeightToRectConverter}"> + <Binding RelativeSource="{RelativeSource AncestorType=Border}" Path="ActualWidth" /> + <Binding RelativeSource="{RelativeSource AncestorType=Border}" Path="ActualHeight" /> + </MultiBinding> + </RectangleGeometry.Rect> + </RectangleGeometry> + </Border.Clip> + <ItemsControl ItemsSource="{Binding Groups}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="1" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Rectangle> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding Color}" /> + </Rectangle.Fill> + </Rectangle> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Border> + + <Grid Grid.Column="1"> + <touch:TouchSlider ValueChanged="TouchSlider_ValueChanged" IsSnapToTickEnabled="True" Minimum="0" Maximum="{Binding Groups.Count,Converter={StaticResource MathOperatorConverter},ConverterParameter='-1'}" Orientation="Vertical" Width="40" Height="Auto" IsSelectionRangeEnabled="False"> + <touch:TouchSlider.ThumbTemplate> + <ControlTemplate> + <touch:TouchIcon Width="40" Height="40" Icon="Water" Angle="-90" /> + </ControlTemplate> + </touch:TouchSlider.ThumbTemplate> + </touch:TouchSlider> + </Grid> + </Grid> + </Grid> + </Grid> + </Grid> +</UserControl> 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 new file mode 100644 index 000000000..ad1c8b50c --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.BL.Catalogs; + +namespace Tango.PPC.Common.Controls +{ + /// <summary> + /// Interaction logic for TwineCatalogControl.xaml + /// </summary> + public partial class TwineCatalogControl : UserControl + { + private Catalog _catalog; + + public TwineCatalogControl() + { + InitializeComponent(); + Loaded += TwineCatalogControl_Loaded; + DataContextChanged += (x, y) => { _catalog = DataContext as Catalog; }; + } + + private void TwineCatalogControl_Loaded(object sender, RoutedEventArgs e) + { + + } + + private void TouchSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) + { + if (_catalog != null) + { + list.ScrollToItem(_catalog.Groups.ElementAt(_catalog.Groups.Count - 1 - (int)e.NewValue)); + } + } + } +} |
