HandyOrg/HandyControl · error · NotSupportedException

SameButtons

Error message

SameButtons

What it means

Sentinel guard in RangeTrack's DecreaseRepeatButton setter: assigning a RepeatButton instance that is already used as the increase or center button throws NotSupportedException("SameButtons"). It fires when the same RepeatButton control is assigned to more than one slot of the range slider track.

Solutions

  1. Assign a distinct RepeatButton instance to each of DecreaseRepeatButton, IncreaseRepeatButton and CenterButton
  2. If reusing a button is intended, create a new RepeatButton with equivalent properties instead of sharing the instance
  3. Enforce this in XAML/templates by giving each part its own x:Name and binding
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at src/Shared/HandyControl_Shared/Controls/Slider/RangeSlider/RangeTrack.cs:36 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HandyOrg/HandyControl@2c0875ebd6 (2026-09-14). Data as JSON: /api/errors/7b859e28a4573813. Report an issue: GitHub.

Appendix: source

Thrown at src/Shared/HandyControl_Shared/Controls/Slider/RangeSlider/RangeTrack.cs:36

    private RepeatButton _decreaseButton;

    private RangeThumb _thumbStart;

    private RangeThumb _thumbEnd;

    private Visual[] _visualChildren;

    private double Density { get; set; } = double.NaN;

    public RepeatButton DecreaseRepeatButton
    {
        get => _decreaseButton;
        set
        {
            if (Equals(_increaseButton, value) || Equals(_centerButton, value))
            {
                throw new NotSupportedException("SameButtons");
            }
            UpdateComponent(_decreaseButton, value);
            _decreaseButton = value;

            if (_decreaseButton != null)
            {
                CommandManager.InvalidateRequerySuggested(); // Should post an idle queue item to update IsEnabled on button
            }
        }
    }

    public RepeatButton CenterRepeatButton
    {
        get => _centerButton;
        set
        {
            if (Equals(_increaseButton, value) || Equals(_decreaseButton, value))
            {

View on GitHub (pinned to 2c0875ebd6)