diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-01-20 17:22:35 +0200 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2022-01-20 17:22:35 +0200 |
| commit | 873de6078c8e53067ce772d8bfb214dc026ac54e (patch) | |
| tree | 1cbee36a5d95c48898f870c038c03ffcebc9248e /Software/Visual_Studio/Tango.Touch | |
| parent | 503839dc2436d6310c7e71df80d1c22ba21614de (diff) | |
| download | Tango-873de6078c8e53067ce772d8bfb214dc026ac54e.tar.gz Tango-873de6078c8e53067ce772d8bfb214dc026ac54e.zip | |
Resolved some bugs in new UI PPC
Related Work Items: #6127, #6130, #6136, #6137, #6138
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch')
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> |
