22// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
33// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
44// All Rights Reserved.
5-
65// This Source Code is partially based on the source code provided by the .NET Foundation.
76
87using System . Windows . Controls ;
@@ -20,8 +19,8 @@ namespace Wpf.Ui.Controls;
2019/// <summary>
2120/// Represents a control that can be used to display and edit numbers.
2221/// </summary>
23- //[ToolboxItem(true)]
24- //[ToolboxBitmap(typeof(NumberBox), "NumberBox.bmp")]
22+ // [ToolboxItem(true)]
23+ // [ToolboxBitmap(typeof(NumberBox), "NumberBox.bmp")]
2524public class NumberBox : TextBox
2625{
2726 private bool _valueUpdating ;
@@ -80,7 +79,7 @@ public class NumberBox : TextBox
8079 nameof ( Maximum ) ,
8180 typeof ( double ) ,
8281 typeof ( NumberBox ) ,
83- new PropertyMetadata ( Double . MaxValue )
82+ new PropertyMetadata ( double . MaxValue )
8483 ) ;
8584
8685 /// <summary>
@@ -90,7 +89,7 @@ public class NumberBox : TextBox
9089 nameof ( Minimum ) ,
9190 typeof ( double ) ,
9291 typeof ( NumberBox ) ,
93- new PropertyMetadata ( Double . MinValue )
92+ new PropertyMetadata ( double . MinValue )
9493 ) ;
9594
9695 /// <summary>
@@ -231,7 +230,7 @@ public double Minimum
231230 }
232231
233232 /// <summary>
234- /// Gets or sets whether the control will accept and evaluate a basic formulaic expression entered as input.
233+ /// Gets or sets a value indicating whether the control will accept and evaluate a basic formulaic expression entered as input.
235234 /// </summary>
236235 public bool AcceptsExpression
237236 {
@@ -312,7 +311,6 @@ protected override void OnKeyUp(KeyEventArgs e)
312311 UpdateValueFromText ( ) ;
313312 ValidateValue ( Value ) ;
314313 MoveCaretToTextEnd ( ) ;
315- TriggerValueUpdate ( ) ;
316314 }
317315
318316 break ;
@@ -368,7 +366,7 @@ ControlTemplate newTemplate
368366 base . OnTemplateChanged ( oldTemplate , newTemplate ) ;
369367
370368 // If Text has been set, but Value hasn't, update Value based on Text.
371- if ( String . IsNullOrEmpty ( Text ) && Value != null )
369+ if ( string . IsNullOrEmpty ( Text ) && Value != null )
372370 {
373371 SetCurrentValue ( ValueProperty , null ) ;
374372 }
@@ -391,7 +389,7 @@ protected override void OnLostFocus(RoutedEventArgs e)
391389 /// </summary>
392390 protected virtual void OnValueChanged ( DependencyObject d , double ? oldValue )
393391 {
394- var newValue = Value ;
392+ double ? newValue = Value ;
395393
396394 if ( Equals ( newValue , oldValue ) )
397395 {
@@ -425,7 +423,7 @@ private void ValidateValue(double? newValue)
425423 // Correct the text from value
426424 if ( Value is null && Text . Length > 0 )
427425 {
428- SetCurrentValue ( TextProperty , String . Empty ) ;
426+ SetCurrentValue ( TextProperty , string . Empty ) ;
429427 }
430428 else if ( GetParser ( ) . ParseDouble ( Text . Trim ( ) ) != Value )
431429 {
@@ -444,7 +442,7 @@ private void StepValue(double? change)
444442 ) ;
445443#endif
446444
447- var newValue = Value ?? 0 ;
445+ double newValue = Value ?? 0 ;
448446
449447 if ( change is not null )
450448 {
0 commit comments