Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 28, 2025

Fixes issue where the Additional Packages dropdown becomes permanently disabled after selecting "Virtual" control type, preventing users from modifying package selections when switching back to other control types.

Problem

When users select "Virtual" from the Control Type dropdown, the Additional Packages dropdown is correctly disabled and set to "Fluent UI". However, when switching back to "Standard" or other control types, the dropdown remains disabled, making it impossible to change additional package selections.

Additionally, when loading existing controls, saved additional package selections were not being restored from the AdditionalPackageIndex property.

Root Cause

  1. The cboxControlType_SelectedIndexChanged event handler only handled the "Virtual" case but had no else clause to re-enable the dropdown for other control types
  2. The PopulateControlDetails method wasn't restoring the saved AdditionalPackageIndex value when loading existing controls
  3. The AdditionalPackageIndex property wasn't initialized to a default value, potentially causing inconsistent behavior

Solution

Made three minimal changes:

1. Enhanced Event Handler

private void cboxControlType_SelectedIndexChanged(object sender, EventArgs e)
{
    if (cboxControlType.SelectedItem != null && (string)cboxControlType.SelectedItem == "Virtual")
    {
        cboxAdditionalPackages.SelectedIndex = 1;
        cboxAdditionalPackages.Enabled = false;
    }
    else
    {
        // Re-enable the additional packages dropdown for non-Virtual control types
        cboxAdditionalPackages.Enabled = true;
    }
}

2. Restore Saved Selection

// In PopulateControlDetails method
cboxAdditionalPackages.SelectedIndex = ControlDetails.AdditionalPackageIndex;

3. Default Initialization

// In ControlManifestDetails constructor
AdditionalPackageIndex = 0; // Default to "None" (first item in the dropdown)

Testing

The fix ensures:

  • ✅ Virtual controls: Additional packages set to "Fluent UI" and dropdown disabled
  • ✅ Standard controls: Additional packages dropdown enabled and preserves user selections
  • ✅ Existing controls: Saved additional package selections are properly restored
  • ✅ Seamless switching between Virtual and Standard control types

Resolves the issue reported in version 2.20263.6.162 where users experienced the "Additional package selection is required prompt is appearing while trying to build control and that selection is disabled."

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: Additional Packages Required Prompt</issue_title>
<issue_description>### Contact Details

inguva.vamsi@gmail.com

What happened?

Hi

Additional package selection is required prompt is appearing while trying to build control and that selection is disabled. this is not happening in old version. please let me know how can i give information to this selection

What version of the tool are you using?

2.20263.6.162

What version of XrmToolBox are you running?

1.2024.9.69

Relevant log output

```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>
Fixes #72

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…trols

Co-authored-by: Power-Maverick <36135520+Power-Maverick@users.noreply.github.com>
Copilot AI changed the title [WIP] [Bug]: Additional Packages Required Prompt Fix Additional Packages dropdown becoming permanently disabled Sep 28, 2025
@Power-Maverick Power-Maverick marked this pull request as ready for review September 28, 2025 21:07
Copilot AI review requested due to automatic review settings September 28, 2025 21:07
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 where the Additional Packages dropdown becomes permanently disabled after selecting "Virtual" control type, preventing users from modifying package selections when switching to other control types. It also ensures saved additional package selections are properly restored when loading existing controls.

  • Added an else clause to re-enable the Additional Packages dropdown for non-Virtual control types
  • Restored saved AdditionalPackageIndex value when populating control details
  • Initialized AdditionalPackageIndex to a default value of 0 in the constructor

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
PCFBuilder.cs Enhanced event handler to re-enable dropdown for non-Virtual types and restore saved package selection
ControlManifestDetails.cs Added default initialization for AdditionalPackageIndex property

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Power-Maverick Power-Maverick merged commit b715256 into master Sep 30, 2025
3 checks passed
@Power-Maverick Power-Maverick deleted the copilot/fix-2ba27a53-0091-4c24-8389-bf0bf97675b9 branch September 30, 2025 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Additional Packages Required Prompt

2 participants