aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2021-11-02 13:30:37 +0200
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2021-11-02 13:30:37 +0200
commit3007971a75b018daab6e4dc72bbe6ab1191cff25 (patch)
tree42777763e53e251d1fe239ddbf6c6cf69c3b598d /Software/Visual_Studio/Tango.Touch
parent20f49c625cd32b95154db138ed7eeebbadd04bf7 (diff)
downloadTango-3007971a75b018daab6e4dc72bbe6ab1191cff25.tar.gz
Tango-3007971a75b018daab6e4dc72bbe6ab1191cff25.zip
Jobs V2
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch')
-rw-r--r--Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/MultiRangeSlider.cs4
-rw-r--r--Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchSliderThreeThumbs.cs58
-rw-r--r--Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchSliderThreeThumbs.xaml6
3 files changed, 41 insertions, 27 deletions
diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/MultiRangeSlider.cs b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/MultiRangeSlider.cs
index 8e104c7ac..beb34e6f4 100644
--- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/MultiRangeSlider.cs
+++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/MultiRangeSlider.cs
@@ -121,8 +121,8 @@ namespace Tango.Touch.Controls
IsFirst = false;
IsLast = false;
- Maximum = 0;
- Minimum = 100;
+ // Maximum = 0;
+ // Minimum = 100;
}
static MultiRangeSlider()
diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchSliderThreeThumbs.cs b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchSliderThreeThumbs.cs
index 9c5ba6fd4..230bfea8c 100644
--- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchSliderThreeThumbs.cs
+++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchSliderThreeThumbs.cs
@@ -55,7 +55,7 @@ namespace Tango.Touch.Controls
}
public static readonly DependencyProperty LowerValueProperty =
- DependencyProperty.Register("LowerValue", typeof(double), typeof(TouchSliderThreeThumbs), new FrameworkPropertyMetadata(0d));
+ DependencyProperty.Register("LowerValue", typeof(double), typeof(TouchSliderThreeThumbs), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
public double UpperValue
{
@@ -63,15 +63,15 @@ namespace Tango.Touch.Controls
set { SetValue(UpperValueProperty, value); }
}
public static readonly DependencyProperty UpperValueProperty =
- DependencyProperty.Register("UpperValue", typeof(double), typeof(TouchSliderThreeThumbs), new FrameworkPropertyMetadata(100d));
+ DependencyProperty.Register("UpperValue", typeof(double), typeof(TouchSliderThreeThumbs), new FrameworkPropertyMetadata(100d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
public double MiddleValue
{
get { return (double)GetValue(MiddleValueProperty); }
set { SetValue(MiddleValueProperty, value); }
}
- public static readonly DependencyProperty MiddleValueProperty = DependencyProperty.Register("MiddleValue", typeof(double), typeof(TouchSliderThreeThumbs),
- new FrameworkPropertyMetadata(50d));
+ public static readonly DependencyProperty MiddleValueProperty = DependencyProperty.Register("MiddleValue", typeof(double), typeof(TouchSliderThreeThumbs),
+ new FrameworkPropertyMetadata(50d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
public double MinimumMiddleRange
{
@@ -178,38 +178,47 @@ namespace Tango.Touch.Controls
{
base.OnApplyTemplate();
- //if (_lowerSlider != null)
- // _lowerSlider.ValueChanged -= LowerSlider_ValueChanged;
- LowerValue = Minimum;
- UpperValue = Maximum;
+ if (_lowerSlider != null)
+ _lowerSlider.ValueChanged -= LowerSlider_ValueChanged;
+ // LowerValue = Minimum;
+ //UpperValue = Maximum;
_lowerSlider = GetTemplateChild(PART_LowerSlider) as MultiRangeSlider;
if(_lowerSlider != null)
{
- _lowerSlider.Value = Minimum;
_lowerSlider.LeftValue = Minimum;
+ _lowerSlider.RightValue = UpperValue;
_lowerSlider.IsFirst = true;
_lowerSlider.MultiRangeSliderValueChanged += LowerSlider_ValueChanged;
_lowerSlider.TouchDown += TouchDownSlider;
+ _lowerSlider.Value = LowerValue;
}
+ if(_middleSlider != null)
+ _middleSlider.MultiRangeSliderValueChanged -= MiddleSlider_ValueChanged;
+
_middleSlider = GetTemplateChild(Part_MiddleSlider) as MultiRangeSlider;
if(_middleSlider != null)
{
- _middleSlider.LeftValue = 0;
- _middleSlider.Value = (Maximum - Minimum) / 2;
+ _middleSlider.LeftValue = LowerValue;
+ _middleSlider.RightValue = UpperValue;
_middleSlider.MultiRangeSliderValueChanged += MiddleSlider_ValueChanged;
_middleSlider.TouchDown += TouchDownSlider;
+ _middleSlider.Value = MiddleValue;// (Maximum - Minimum) / 2;
}
+ if (_upperSlider != null)
+ _upperSlider.MultiRangeSliderValueChanged -= UpperSlider_ValueChanged;
+
_upperSlider = GetTemplateChild(PART_UpperSlider) as MultiRangeSlider;
if(_upperSlider != null)
{
- _upperSlider.Value = Maximum;
+ _upperSlider.LeftValue = MiddleValue;
_upperSlider.RightValue = Maximum;
_upperSlider.IsLast = true;
_upperSlider.MultiRangeSliderValueChanged += UpperSlider_ValueChanged;
_upperSlider.TouchDown += TouchDownSlider;
+ _upperSlider.Value = UpperValue;
}
//var ob = FindResource("SliderThumbWidth");
m_thumbWidth = 31;
@@ -247,10 +256,12 @@ namespace Tango.Touch.Controls
if ((int)e.OldValue != (int)e.NewValue)
{
LowerValue = e.NewValue;
- _middleSlider.MinimumValue = LowerValue;
+ if(_middleSlider != null)
+ _middleSlider.MinimumValue = LowerValue;
double minrangeValue = (MinimumMiddleRange * 100) / Length;
var limit = LowerValue + minrangeValue;
- _upperSlider.MinimumValue = Math.Max(MiddleValue, LimitUpperValueRange);
+ if(_upperSlider != null)
+ _upperSlider.MinimumValue = Math.Max(MiddleValue, LimitUpperValueRange);
}
}
@@ -259,9 +270,10 @@ namespace Tango.Touch.Controls
if ((int)e.OldValue != (int)e.NewValue)
{
MiddleValue = e.NewValue;
- _lowerSlider.MaximumValue = Math.Min(MiddleValue, LimitLowerValueRange);
-
- _upperSlider.MinimumValue = Math.Max(MiddleValue, LimitUpperValueRange);
+ if(_lowerSlider != null)
+ _lowerSlider.MaximumValue = Math.Min(MiddleValue, LimitLowerValueRange);
+ if (_upperSlider != null)
+ _upperSlider.MinimumValue = Math.Max(MiddleValue, LimitUpperValueRange);
}
}
@@ -270,26 +282,28 @@ namespace Tango.Touch.Controls
if ((int)e.OldValue != (int)e.NewValue)
{
UpperValue = e.NewValue;
- _middleSlider.MaximumValue = UpperValue;
+ if (_middleSlider != null)
+ _middleSlider.MaximumValue = UpperValue;
double minrangeValue = (MinimumMiddleRange * 100) / Length;
var limit = UpperValue - minrangeValue;
- _lowerSlider.MaximumValue = Math.Min(MiddleValue, LimitLowerValueRange);
+ if (_lowerSlider != null)
+ _lowerSlider.MaximumValue = Math.Min(MiddleValue, LimitLowerValueRange);
}
}
private void ArrangeSliders()
{
- if (_lowerSlider != null)
+ if (_lowerSlider != null && ThumbValue != 0)
{
_lowerSlider.Maximum = Maximum + ThumbValue * 2;
_lowerSlider.Minimum = Minimum;
}
- if (_middleSlider != null)
+ if (_middleSlider != null && ThumbValue != 0)
{
_middleSlider.Maximum = Maximum + ThumbValue * 1;
_middleSlider.Minimum = Minimum - ThumbValue;
}
- if (_upperSlider != null)
+ if (_upperSlider != null && ThumbValue != 0)
{
_upperSlider.Maximum = Maximum;
_upperSlider.Minimum = Minimum - ThumbValue * 2;
diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchSliderThreeThumbs.xaml b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchSliderThreeThumbs.xaml
index 2c59b8f94..20319c8ad 100644
--- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchSliderThreeThumbs.xaml
+++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchSliderThreeThumbs.xaml
@@ -16,12 +16,12 @@
<Border x:Name="TrackBackground" BorderBrush="Transparent" BorderThickness="0" Background="Transparent" Grid.Row="1" VerticalAlignment="center" >
</Border>
- <local:MultiRangeSlider x:Name="PART_LowerSlider" Height="32" Margin="0 0 0 0" Minimum="0" Maximum="100" LeftValue="0" RightValue="33" Foreground="{StaticResource TangoDarkForegroundBrush}"
+ <local:MultiRangeSlider x:Name="PART_LowerSlider" Height="32" Margin="0 0 0 0" Minimum="0" Maximum="100" Foreground="{StaticResource TangoDarkForegroundBrush}"
IsSnapToTickEnabled="True" TickFrequency="1" AutoToolTipPlacement="BottomRight"/>
- <local:MultiRangeSlider x:Name="Part_MiddleSlider" Height="32" Margin="10 0 0 0" Minimum="0" Maximum="100" LeftValue="34" RightValue="66" Foreground="{StaticResource TangoDarkForegroundBrush}"
+ <local:MultiRangeSlider x:Name="Part_MiddleSlider" Height="32" Margin="10 0 0 0" Minimum="0" Maximum="100" Foreground="{StaticResource TangoDarkForegroundBrush}"
IsSnapToTickEnabled="True" TickFrequency="1" AutoToolTipPlacement="BottomRight" />
- <local:MultiRangeSlider x:Name="PART_UpperSlider" Height="32" Margin="10 0 2 0" Minimum="0" Maximum="100" LeftValue="67" RightValue="100" Foreground="{StaticResource TangoDarkForegroundBrush}"
+ <local:MultiRangeSlider x:Name="PART_UpperSlider" Height="32" Margin="10 0 2 0" Minimum="0" Maximum="100" Foreground="{StaticResource TangoDarkForegroundBrush}"
IsSnapToTickEnabled="True" TickFrequency="1" AutoToolTipPlacement="BottomRight"/>
</Grid>