Skip to content

Commit 823546f

Browse files
committed
Ensured that dynamic menu items are visible and enabled by default.
1 parent 2020952 commit 823546f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/toolkit/Community.VisualStudio.Toolkit.Shared/Commands/BaseDynamicCommand.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ internal sealed override void BeforeQueryStatus(object sender, EventArgs e)
6767
// is out of bounds, then we'll hide and disable the menu item.
6868
if (TryGetItem(index, out TItem item))
6969
{
70+
// If there are no items, then each dynamic menu item will be disabled and
71+
// hidden in the `else` case below. We don't want to rely on `BeforeQueryStatus`
72+
// having to make the menu items enabled and visible, so we will make them enabled
73+
// and visible by default, and `BeforeQueryStatus` can change that if it needs to.
74+
menuItem.Enabled = true;
75+
menuItem.Visible = true;
76+
7077
BeforeQueryStatus(menuItem, e, item);
7178

7279
// Store the index in the menu item's properties so that we can

0 commit comments

Comments
 (0)