internal static BaseActionDef LoadFromXml(XElement xml) { if (xml.Name.LocalName.EndsWith("actions")) { return(ActionGroupDef.LoadFromXml(xml)); } return(ActionDef.LoadFromXml(xml)); }
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 void CreateContextMenus() { _cardHeader = null; _defaultGroupAction = _defaultCardAction = null; GroupDef def = group.Definition; // Create the card actions List<Control> cardItems = CreateCardMenuItems(def); _cardMenu.Collection = cardItems; // Create the group actions List<Control> groupItems = CreateGroupMenuItems(def); _groupMenu.Collection = groupItems; }
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; }
private void CreateContextMenus() { cardHeader = null; defaultGroupAction = defaultCardAction = null; var def = group.Definition; // Create the card actions var cardItems = CreateCardMenuItems(def); cardMenu.Collection = cardItems; // Create the group actions var groupItems = CreateGroupMenuItems(def); groupMenu.Collection = groupItems; }