private static void OnItemHeightOrWidthPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { OffsetPanel source = (OffsetPanel)d; double value = (double)e.NewValue; if (source.ignorePropertyChange) { source.ignorePropertyChange = false; return; } if (!double.IsNaN(value) && ((value <= 0.0) || double.IsPositiveInfinity(value))) { source.ignorePropertyChange = true; source.SetValue(e.Property, (double)e.OldValue); throw new ArgumentException("OnItemHeightOrWidthPropertyChanged InvalidValue", "value"); } source.InvalidateMeasure(); }
private static void OnMaximumColumnsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { OffsetPanel source = (OffsetPanel)d; int value = (int)e.NewValue; if (source.ignorePropertyChange) { source.ignorePropertyChange = false; return; } if (value < int.MinValue || value > int.MaxValue) { source.ignorePropertyChange = true; source.SetValue(e.Property, (int)e.OldValue); throw new ArgumentException("OnMaximumColumnsPropertyChanged InvalidValue", "value"); } source.InvalidateMeasure(); }