private static void OnDecimalDigitsChanged(DependencyObject depobj, DependencyPropertyChangedEventArgs evargs) { MaskEditNumber Target = depobj as MaskEditNumber; byte NewValue = (byte)evargs.NewValue; Target.ValidateAndExpose(); }
private static void OnMaxLimitChanged(DependencyObject depobj, DependencyPropertyChangedEventArgs evargs) { MaskEditNumber Target = depobj as MaskEditNumber; decimal NewValue = (decimal)evargs.NewValue; Target.ValidateAndExpose(); }
private static void OnFormatChanged(DependencyObject depobj, DependencyPropertyChangedEventArgs evargs) { MaskEditNumber Target = depobj as MaskEditNumber; string NewValue = (string)evargs.NewValue; // Do not use format on editing (would put group separators). Target.ValidateAndExpose(); }
private static void OnEditingValueChanged(DependencyObject depobj, DependencyPropertyChangedEventArgs evargs) { // IMPORTANT: Do not accept null values, because it can fall in // an event infinite-loop chain when selected thru popup listbox. if (evargs.NewValue == null) // Drop-down cancelled? { return; } MaskEditNumber Target = depobj as MaskEditNumber; decimal NewValue = (decimal)evargs.NewValue; var NewText = NewValue.ToString(CultureInfo.InvariantCulture.NumberFormat); if (NewText != Target.Editor.Text) { Target.Editor.Text = NewText; Target.Editor.SelectAll(); } }
private static void OnValueChanged(DependencyObject depobj, DependencyPropertyChangedEventArgs evargs) { // IMPORTANT: Do not accept null values, because it can fall in // an event infinite-loop chain when selected thru popup listbox. if (evargs.NewValue == null) // Drop-down cancelled? { return; } MaskEditNumber Target = depobj as MaskEditNumber; decimal NewValue = (decimal)evargs.NewValue; Target.EditingValue = NewValue; if (Target.EditingAction != null) { Target.EditingAction(NewValue); } if (Target.ApplyDirectAccess && NewValue != General.Try(() => Convert.ToDecimal(Target.PerformDirectRead(Target.StorageFieldName)), decimal.MaxValue)) { Target.PerformDirectWrite(Target.StorageFieldName, NewValue); } }