protected override void OnPropertyChanged(AdvancedPropertyChangedEventArgs e) { if (e.HasPropertyChanged(() => SelectedColumn)) { SetColorPickers(); } else if (e.HasPropertyChanged(() => Grid)) { SetColorPickers(); } else if (e.HasPropertyChanged(() => ForeColor)) { if (Columns.FirstOrDefault(x => x.Name == SelectedColumn.Name) != null) { var column = Columns.First(x => x.Name == SelectedColumn.Name); column.IsChangedColor = !ForeColor.Equals(column.ForeColor); column.ForeColor = ForeColor; } SelectedColumn.ForeColor = ForeColor; } else if (e.HasPropertyChanged(() => BackColor)) { if (Columns.FirstOrDefault(x => x.Name == SelectedColumn.Name) != null) { var column = Columns.First(x => x.Name == SelectedColumn.Name); column.IsChangedColor = !BackColor.Equals(column.BackColor); column.BackColor = BackColor; } SelectedColumn.BackColor = BackColor; } base.OnPropertyChanged(e); }
protected override void OnPropertyChanged(AdvancedPropertyChangedEventArgs e) { base.OnPropertyChanged(e); if (Time is not null && !string.IsNullOrEmpty(e.PropertyName) && e.HasPropertyChanged(e.PropertyName)) { if (Is24Hour) { if (AmPm == Meridiem.PM) { if (Time.Value.Hours < 12) { var newTimeValue = new TimeSpan(Time.Value.Hours + 12, Time.Value.Minutes, Time.Value.Seconds); TimeValueString = newTimeValue.ToString(); } else { var newTimeValue = new TimeSpan(Time.Value.Hours - 12, Time.Value.Minutes, Time.Value.Seconds); TimeValueString = newTimeValue.ToString(); } } else { TimeValueString = Time.Value.ToString(); } } else { TimeValueString = Time.Value.ToString() + " " + AmPm.ToString(); } }
protected override void OnPropertyChanged(AdvancedPropertyChangedEventArgs e) { base.OnPropertyChanged(e); const int averageDaysInYear = 365; const int averageDaysInMonth = 30; if (!e.HasPropertyChanged(() => SelectedSpanType) && !e.HasPropertyChanged(() => Amount)) { return; } switch (SelectedSpanType) { case TimeSpanType.Years: Value = TimeSpan.FromDays(Amount * averageDaysInYear); break; case TimeSpanType.Months: Value = TimeSpan.FromDays(Amount * averageDaysInMonth); break; case TimeSpanType.Days: Value = TimeSpan.FromDays(Amount); break; case TimeSpanType.Hours: Value = TimeSpan.FromHours(Amount); break; case TimeSpanType.Minutes: Value = TimeSpan.FromMinutes(Amount); break; case TimeSpanType.Seconds: Value = TimeSpan.FromSeconds(Amount); break; default: throw new NotSupportedException(string.Format(LanguageHelper.GetString("FilterBuilder_Exception_Message_TypeIsNotSupported_Pattern"), SelectedSpanType)); } }
protected override void OnPropertyChanged(AdvancedPropertyChangedEventArgs e) { base.OnPropertyChanged(e); if (DateTimeValue != null && !string.IsNullOrEmpty(e.PropertyName) && e.HasPropertyChanged(e.PropertyName) && DateTimeValue.Value != null && SelectedFormat != null) { DateTimeValueString = DateTimeValue.Value.ToString(SelectedFormat.FormatValue); } else { DateTimeValueString = string.Empty; } }
protected override void OnPropertyChanged(AdvancedPropertyChangedEventArgs e) { base.OnPropertyChanged(e); if (e.HasPropertyChanged(() => SelectedSpanType) || e.HasPropertyChanged(() => Amount)) { switch (SelectedSpanType) { case TimeSpanType.Years: Value = TimeSpan.FromDays(Amount * AverageDaysInYear); break; case TimeSpanType.Months: Value = TimeSpan.FromDays(Amount * AverageDaysInMonth); break; case TimeSpanType.Days: Value = TimeSpan.FromDays(Amount); break; case TimeSpanType.Hours: Value = TimeSpan.FromHours(Amount); break; case TimeSpanType.Minutes: Value = TimeSpan.FromMinutes(Amount); break; case TimeSpanType.Seconds: Value = TimeSpan.FromSeconds(Amount); break; default: throw new NotSupportedException(string.Format("Type '{0}' is not supported.", SelectedSpanType)); } } }