Skip to content

Conversation

@LeafShi1
Copy link
Member

@LeafShi1 LeafShi1 commented Dec 24, 2025

Fixes #14160

Root Cause

The UpdateEnabled() method in CollectionEditorCollectionForm only checked if the collection had more than one item (_listBox.Items.Count > 1) to enable the Up/Down buttons, but failed to verify the selected item's position in the list.

Proposed changes

  • Updated the button enable logic in CollectionEditor.CollectionEditorCollectionForm.cs
    • Up button: Only enabled when SelectedIndex > 0 (not at first position)
    • Down button: Only enabled when SelectedIndex < Items.Count - 1 (not at last position)

Customer Impact

  • Buttons now correctly reflect whether items can be moved up/down

Regression?

  • No

Risk

  • Minimal

Screenshots

Before

  • When the first TabPage is selected:

    Up button should be disabled, but remains enabled.

    Image
  • When the last TabPage is selected:

    Down button should be disabled, but remains enabled.

    Image

After

Selecting the first TabPage disables the Up button; Selecting the last TabPage disables the Down button

AfterChanges.mp4

Test methodology

  • Manually

Test environment(s)

  • .net 11.0.0-alpha.1.25617.103
Microsoft Reviewers: Open in CodeFlow

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the CollectionEditor dialog where the Up/Down buttons incorrectly remained enabled when the first or last item was selected. The fix adds position-based checks to ensure buttons are only enabled when items can actually be moved in the respective direction.

Key Changes:

  • Enhanced button enable logic in UpdateEnabled() to check selected item position
  • Up button now requires SelectedIndex > 0 (not at first position)
  • Down button now requires SelectedIndex < Items.Count - 1 (not at last position)

@codecov
Copy link

codecov bot commented Dec 24, 2025

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.01362%. Comparing base (01eefd4) to head (f2d183b).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #14163         +/-   ##
===================================================
- Coverage   77.15180%   76.01362%   -1.13818%     
===================================================
  Files           3279        3279                 
  Lines         645333      645333                 
  Branches       47720       47720                 
===================================================
- Hits          497886      490541       -7345     
- Misses        143754      145482       +1728     
- Partials        3693        9310       +5617     
Flag Coverage Δ
Debug 76.01362% <0.00000%> (-1.13818%) ⬇️
integration ?
production 49.46327% <0.00000%> (-2.55080%) ⬇️
test 97.40559% <ø> (ø)
unit 49.46327% <0.00000%> (-0.00418%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TabPage Collection Editor: Up/Down buttons do not update enabled state correctly for first/last TabPage

2 participants