aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2022-01-30 14:45:35 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2022-01-30 14:45:35 +0200
commit7340cf3da145a6eff01903fc7cf9da15983bf8af (patch)
treee027e35068749df40174c6725c133669d83cb8fe /Software/Visual_Studio/Tango.Touch
parent99ab23894ab92eb93774cca163c5558c43e6180f (diff)
parent94506b081ec7cd46a7088718902313401999cb90 (diff)
downloadTango-7340cf3da145a6eff01903fc7cf9da15983bf8af.tar.gz
Tango-7340cf3da145a6eff01903fc7cf9da15983bf8af.zip
Merged Vica Fixes to new PPC UI.
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch')
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs5
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml2
-rw-r--r--Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs10
-rw-r--r--Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml4
4 files changed, 13 insertions, 8 deletions
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs
index 224f2d25b..77891b36b 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs
@@ -280,6 +280,11 @@ namespace Tango.Touch.Controls
e.Handled = true;
return;
}
+ else if(e.Text == "." && HasDecimalPoint)
+ {
+ e.Handled = false;
+ return;
+ }
if (e.Text == "-" && !_text_box.Text.Contains("-"))
{
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml
index 8963c9c3e..a47d890b7 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml
@@ -81,7 +81,7 @@
<Border Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" CornerRadius="2" Width="54">
<local:TouchNumericTextBox x:Name="Number_PART" Margin="0 4 0 0" FontSize="20" HorizontalContentAlignment="Center" VerticalAlignment="Center" BorderBrush="{TemplateBinding BorderBrush}" VerticalContentAlignment="Center" UpdateBindingOnlyWhenFocused="True"
- Value="{Binding Value,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" Minimum="{Binding MinValue,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" Maximum="{Binding MaxValue,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}"/>
+ Value="{Binding Value,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" Minimum="{Binding MinValue,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" Maximum="{Binding MaxValue,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" HasDecimalPoint="True" StringFormat="0.#"/>
</Border>
<Border Margin="10 0 0 0" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="80">
diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs
index 12ac39f3f..ab319b479 100644
--- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs
+++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs
@@ -76,7 +76,7 @@ namespace Tango.Touch.Controls
public void OnMaxPropertyChanged()
{
if(_colorPickerNumericUpDown != null)
- _colorPickerNumericUpDown.MaxValue = MaxValue;
+ _colorPickerNumericUpDown.MaxValue = Math.Round(MaxValue, 1, MidpointRounding.AwayFromZero);
if(_colorPickerSlider != null)
_colorPickerSlider.Maximum = MaxValue;
@@ -203,8 +203,8 @@ namespace Tango.Touch.Controls
if (_colorPickerNumericUpDown != null)
{
_colorPickerNumericUpDown.MinValue = MinValue;
- _colorPickerNumericUpDown.MaxValue = MaxValue;
- _colorPickerNumericUpDown.Value = ColorValue;
+ _colorPickerNumericUpDown.MaxValue = Math.Round(MaxValue, 1, MidpointRounding.AwayFromZero);
+ _colorPickerNumericUpDown.Value = Math.Round( ColorValue, 1, MidpointRounding.AwayFromZero);
_colorPickerNumericUpDown.ColorNumberChanged += ColorPickerNumber_ValueChanged;
}
}
@@ -222,9 +222,9 @@ namespace Tango.Touch.Controls
}
public void ColorPickerSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
- if (_colorPickerNumericUpDown != null && _colorPickerNumericUpDown.Value != e.NewValue)
+ if (_colorPickerNumericUpDown != null && _colorPickerNumericUpDown.Value != Math.Round(e.NewValue, 1, MidpointRounding.AwayFromZero))
{
- _colorPickerNumericUpDown.Value = e.NewValue;
+ _colorPickerNumericUpDown.Value = Math.Round(e.NewValue, 1, MidpointRounding.AwayFromZero);
OnPickerSliderValueChanged(e.OldValue, e.NewValue);
}
}
diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml
index 5e2d2eb87..906e181c8 100644
--- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml
+++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml
@@ -22,7 +22,7 @@
</Grid.ColumnDefinitions>
<Grid Grid.Row="0">
<TextBlock FontSize="{StaticResource TangoComboBoxItemFontSize}" TextBlock.Text="{Binding ColorPickerText, RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}}" HorizontalAlignment="Left" Margin="6 0 0 0" FontWeight="SemiBold" VerticalAlignment="Center" />
- <local:TouchNumericUpDownConrol x:Name="PART_ColorPickerNumericUpDown" HorizontalAlignment="Right" BorderThickness="0.8" BorderBrush="{TemplateBinding BorderBrush}" Margin="0 0 5 0" MaxValue="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=MaxValue}"/>
+ <local:TouchNumericUpDownConrol x:Name="PART_ColorPickerNumericUpDown" HorizontalAlignment="Right" BorderThickness="0.8" BorderBrush="{TemplateBinding BorderBrush}" Margin="0 0 5 0" MaxValue="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=MaxValue, StringFormat='0.##'}"/>
</Grid>
<local:TouchColorPickerSlider x:Name="PART_ColorPickerSlider" Grid.Row="1" Margin=" 0 10 0 0" Background="{TemplateBinding Background}"
ThumbHeightInside ="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=ThumbHeightInside}"
@@ -32,7 +32,7 @@
Maximum="{Binding MaxValue, RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}}"/>
<DockPanel Grid.Row="2" Margin=" 0 0 0 0">
<TextBlock DockPanel.Dock="Left" FontSize="{StaticResource TangoSmallFontSize}" TextBlock.Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=MinValue}" HorizontalAlignment="Left" Margin="6 0 0 0" VerticalAlignment="Center" FontWeight="SemiBold"/>
- <TextBlock DockPanel.Dock="Right" FontSize="{StaticResource TangoSmallFontSize}" TextBlock.Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=MaxValue}" HorizontalAlignment="Right" Margin="6 0 0 0" VerticalAlignment="Center" FontWeight="SemiBold" />
+ <TextBlock DockPanel.Dock="Right" FontSize="{StaticResource TangoSmallFontSize}" TextBlock.Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=MaxValue, StringFormat='0.0'}" HorizontalAlignment="Right" Margin="6 0 0 0" VerticalAlignment="Center" FontWeight="SemiBold" />
</DockPanel>
</Grid>
</ControlTemplate>