private MenuItem CreateCardMenuItem(BaseActionDef baseAction) { var item = new MenuItem {Header = baseAction.Name}; var actionGroupDef = baseAction as ActionGroupDef; if (actionGroupDef != null) { foreach (MenuItem subItem in actionGroupDef.Children.Select(CreateCardMenuItem)) item.Items.Add(subItem); return item; } var action = baseAction as ActionDef; item.Tag = action; if (action != null) { item.InputGestureText = action.Shortcut; if (action.DefaultAction) { item.FontWeight = FontWeights.Bold; _defaultCardAction = action; } } item.Click += CardActionClicked; return item; }
private MenuItem CreateCardMenuItem(BaseActionDef baseAction) { MenuItem item = new MenuItem() { Header = baseAction.Name }; var group = baseAction as ActionGroupDef; if (group != null) { foreach (var subItem in group.Children.Select(x => CreateCardMenuItem(x))) item.Items.Add(subItem); return item; } var action = baseAction as ActionDef; item.Tag = action; item.InputGestureText = action.Shortcut; if (action.DefaultAction) { item.FontWeight = FontWeights.Bold; defaultCardAction = action; } item.Click += CardActionClicked; return item; }