diff --git a/GUI/MainWindow.xaml.cs b/GUI/MainWindow.xaml.cs index 05462654..992c7c71 100644 --- a/GUI/MainWindow.xaml.cs +++ b/GUI/MainWindow.xaml.cs @@ -238,9 +238,19 @@ private void RegisterBindings() this.InputBindings.Add(keyBinding); } - foreach (var entry in TopMenuBar.Items.Cast()) + foreach (var item in TopMenuBar.Items) { - menuItems.Add((string)entry.Header, entry); + if(item is MenuItem entry) + { + if (entry.Header is string label) + { + menuItems.Add(label, entry); + } + else if (!String.IsNullOrWhiteSpace(entry.Name)) + { + menuItems.Add(entry.Name, entry); + } + } } //Generating menu items