Skip to content

Commit 3980e79

Browse files
authored
Fix ShowOnShift (#4877)
1 parent 6dc8389 commit 3980e79

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

Files/Helpers/ContextFlyoutItemHelper.cs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,28 +50,31 @@ public static List<ContextMenuFlyoutItemViewModel> Filter(List<ContextMenuFlyout
5050
{
5151
items = items.Where(x => Check(item: x, currentInstanceViewModel: currentInstanceViewModel, selectedItems: selectedItems, shiftPressed: shiftPressed)).ToList();
5252
items.ForEach(x => x.Items = x.Items.Where(y => Check(item: y, currentInstanceViewModel: currentInstanceViewModel, selectedItems: selectedItems, shiftPressed: shiftPressed)).ToList());
53+
5354
var overflow = items.Where(x => x.ID == "ItemOverflow").FirstOrDefault();
54-
if (overflow != null && !shiftPressed)
55+
if (overflow != null)
5556
{
56-
var overflowItems = items.Where(x => x.ShowOnShift).ToList();
57-
58-
// Adds a separator between items already there and the new ones
59-
if (overflow.Items.Count != 0 && overflow.Items.Last().ItemType != ItemType.Separator && overflowItems.Count > 0)
57+
if (!shiftPressed && App.AppSettings.MoveOverflowMenuItemsToSubMenu) // items with ShowOnShift to overflow menu
6058
{
61-
overflow.Items.Add(new ContextMenuFlyoutItemViewModel()
59+
var overflowItems = items.Where(x => x.ShowOnShift).ToList();
60+
61+
// Adds a separator between items already there and the new ones
62+
if (overflow.Items.Count != 0 && overflow.Items.Last().ItemType != ItemType.Separator && overflowItems.Count > 0)
6263
{
63-
ItemType = ItemType.Separator,
64-
});
64+
overflow.Items.Add(new ContextMenuFlyoutItemViewModel{ ItemType = ItemType.Separator });
65+
}
66+
67+
items = items.Except(overflowItems).ToList();
68+
overflowItems.ForEach(x => overflow.Items.Add(x));
6569
}
66-
overflowItems.ForEach(x => overflow.Items.Add(x));
67-
items = items.Except(overflowItems).ToList();
68-
}
6970

70-
// remove the overflow if it has no child items
71-
if (overflow != null && overflow.Items.Count == 0)
72-
{
73-
items.Remove(overflow);
71+
// remove the overflow if it has no child items
72+
if (overflow.Items.Count == 0)
73+
{
74+
items.Remove(overflow);
75+
}
7476
}
77+
7578
return items;
7679
}
7780

0 commit comments

Comments
 (0)