Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DecimalPointCorrection property to DataGridNumericUpDownColumn #3914

Merged
merged 1 commit into from
Oct 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/MahApps.Metro/Controls/DataGridNumericUpDownColumn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ private NumericUpDown GenerateNumericUpDown(bool isEditing, DataGridCell cell)
SyncColumnProperty(this, numericUpDown, MinimumProperty, NumericUpDown.MinimumProperty);
SyncColumnProperty(this, numericUpDown, MaximumProperty, NumericUpDown.MaximumProperty);
SyncColumnProperty(this, numericUpDown, NumericInputModeProperty, NumericUpDown.NumericInputModeProperty);
SyncColumnProperty(this, numericUpDown, DecimalPointCorrectionProperty, NumericUpDown.DecimalPointCorrectionProperty);
SyncColumnProperty(this, numericUpDown, IntervalProperty, NumericUpDown.IntervalProperty);
SyncColumnProperty(this, numericUpDown, DelayProperty, NumericUpDown.DelayProperty);
SyncColumnProperty(this, numericUpDown, SpeedupProperty, NumericUpDown.SpeedupProperty);
Expand Down Expand Up @@ -293,6 +294,22 @@ public NumericInput NumericInputMode
set { this.SetValue(NumericInputModeProperty, value); }
}

/// <summary>Identifies the <see cref="DecimalPointCorrection"/> dependency property.</summary>
public static readonly DependencyProperty DecimalPointCorrectionProperty
= DependencyProperty.Register(nameof(DecimalPointCorrection),
typeof(DecimalPointCorrectionMode),
typeof(DataGridNumericUpDownColumn),
new PropertyMetadata(default(DecimalPointCorrectionMode)));

/// <summary>
/// Gets or sets the decimal-point correction mode. The default is <see cref="DecimalPointCorrectionMode.Inherits"/>
/// </summary>
public DecimalPointCorrectionMode DecimalPointCorrection
{
get => (DecimalPointCorrectionMode)this.GetValue(DecimalPointCorrectionProperty);
set => this.SetValue(DecimalPointCorrectionProperty, value);
}

/// <summary>Identifies the <see cref="Interval"/> dependency property.</summary>
public static readonly DependencyProperty IntervalProperty =
NumericUpDown.IntervalProperty.AddOwner(
Expand Down Expand Up @@ -566,6 +583,9 @@ protected override void RefreshCellContent(FrameworkElement element, string prop
case nameof(this.NumericInputMode):
SyncColumnProperty(this, numericUpDown, NumericInputModeProperty, NumericUpDown.NumericInputModeProperty);
break;
case nameof(this.DecimalPointCorrection):
SyncColumnProperty(this, numericUpDown, DecimalPointCorrectionProperty, NumericUpDown.DecimalPointCorrectionProperty);
break;
case nameof(this.Interval):
SyncColumnProperty(this, numericUpDown, IntervalProperty, NumericUpDown.IntervalProperty);
break;
Expand Down