public ConfigDesignerElement(View view) : base(view) { var mainPanel = new StackPanelElement(view); // TreeView var itemsTreeView = new TreeViewElement(view); itemsTreeView.SetKeyProperty("Key"); itemsTreeView.SetParentProperty("Parent"); itemsTreeView.SetDisplayProperty("Text"); itemsTreeView.SetImageProperty("Image"); itemsTreeView.SetShowNodeImages(true); itemsTreeView.OnDoubleClick += OnEditItemHandler; mainPanel.AddItem(itemsTreeView); // ToolBar var toolBar = new ToolBarElement(view); mainPanel.AddItem(toolBar); // ContextMenu var contextMenu = new ContextMenuElement(view); itemsTreeView.SetContextMenu(contextMenu); // Update var updateItemsButton = new ToolBarButtonItem(view); updateItemsButton.SetText(Resources.DocumentDesignerRefreshButton); updateItemsButton.SetImage("Actions/Refresh_16x16"); updateItemsButton.SetHotkey("F5"); updateItemsButton.OnClick += OnUpdateItemsHandler; toolBar.AddItem(updateItemsButton); var updateItemsMenuButton = new ContextMenuItem(view); updateItemsMenuButton.SetText(Resources.DocumentDesignerRefreshButton); updateItemsMenuButton.SetImage("Actions/Refresh_16x16"); updateItemsMenuButton.SetHotkey("F5"); updateItemsMenuButton.OnClick += OnUpdateItemsHandler; contextMenu.AddItem(updateItemsMenuButton); // Separator var separator = new ToolBarSeparatorItem(view); toolBar.AddItem(separator); var menuSeparator = new ContextMenuItemSeparator(view); contextMenu.AddItem(menuSeparator); // Add var addItemButton = new ToolBarPopupButtonItem(view); addItemButton.SetText(Resources.DocumentDesignerAddButton); addItemButton.SetImage("Actions/Add_16x16"); addItemButton.SetHotkey("Ctrl+N"); toolBar.AddItem(addItemButton); var addItemMenuButton = new ContextMenuItem(view); addItemMenuButton.SetText(Resources.DocumentDesignerAddButton); addItemMenuButton.SetImage("Actions/Add_16x16"); addItemMenuButton.SetHotkey("Ctrl+N"); contextMenu.AddItem(addItemMenuButton); // Edit var editItemButton = new ToolBarButtonItem(view); editItemButton.SetText(Resources.DocumentDesignerEditButton); editItemButton.SetImage("Actions/Edit_16x16"); editItemButton.SetHotkey("Ctrl+O"); editItemButton.OnClick += OnEditItemHandler; toolBar.AddItem(editItemButton); var editItemMenuButton = new ContextMenuItem(view); editItemMenuButton.SetText(Resources.DocumentDesignerEditButton); editItemMenuButton.SetImage("Actions/Edit_16x16"); editItemMenuButton.SetHotkey("Ctrl+O"); editItemMenuButton.OnClick += OnEditItemHandler; contextMenu.AddItem(editItemMenuButton); // Delete var deleteItemButton = new ToolBarButtonItem(view); deleteItemButton.SetText(Resources.DocumentDesignerDeleteButton); deleteItemButton.SetImage("Actions/Delete_16x16"); deleteItemButton.SetHotkey("Ctrl+Delete"); deleteItemButton.OnClick += OnDeleteItemHandler; toolBar.AddItem(deleteItemButton); var deleteItemMenuButton = new ContextMenuItem(view); deleteItemMenuButton.SetText(Resources.DocumentDesignerDeleteButton); deleteItemMenuButton.SetImage("Actions/Delete_16x16"); deleteItemMenuButton.SetHotkey("Ctrl+Delete"); deleteItemMenuButton.OnClick += OnDeleteItemHandler; contextMenu.AddItem(deleteItemMenuButton); _itemsTreeView = itemsTreeView; _addItemButton = addItemButton; _addItemMenuButton = addItemMenuButton; Control.Content = mainPanel.GetControl(); }
public DocumentSchemaDesignerElement(View view) : base(view) { var mainPanel = new StackPanelElement(view); // TreeView var treeView = new TreeViewElement(view); treeView.SetKeyProperty("Key"); treeView.SetParentProperty("Parent"); treeView.SetImageProperty("Image"); treeView.SetDisplayProperty("Tag.Text"); treeView.SetShowNodeImages(true); treeView.OnDoubleClick += OnEditPropertyHandler; mainPanel.AddItem(treeView); // ToolBar var toolBar = new ToolBarElement(view); mainPanel.AddItem(toolBar); // ContextMenu var contextMenu = new ContextMenuElement(view); treeView.SetContextMenu(contextMenu); // Add var addButton = new ToolBarPopupButtonItem(view); addButton.SetText(Resources.DocumentSchemaDesignerAddButton); addButton.SetImage("Actions/Add_16x16"); addButton.SetHotkey("Ctrl+N"); toolBar.AddItem(addButton); var addMenuButton = new ContextMenuItem(view); addMenuButton.SetText(Resources.DocumentSchemaDesignerAddButton); addMenuButton.SetImage("Actions/Add_16x16"); addMenuButton.SetHotkey("Ctrl+N"); contextMenu.AddItem(addMenuButton); // Edit var editButton = new ToolBarButtonItem(view); editButton.SetText(Resources.DocumentSchemaDesignerEditButton); editButton.SetImage("Actions/Edit_16x16"); editButton.SetHotkey("Ctrl+O"); editButton.OnClick += OnEditPropertyHandler; toolBar.AddItem(editButton); var editMenuButton = new ContextMenuItem(view); editMenuButton.SetText(Resources.DocumentSchemaDesignerEditButton); editMenuButton.SetImage("Actions/Edit_16x16"); editMenuButton.SetHotkey("Ctrl+O"); editMenuButton.OnClick += OnEditPropertyHandler; contextMenu.AddItem(editMenuButton); // Delete var deleteButton = new ToolBarButtonItem(view); deleteButton.SetText(Resources.DocumentSchemaDesignerDeleteButton); deleteButton.SetImage("Actions/Delete_16x16"); deleteButton.SetHotkey("Ctrl+Delete"); deleteButton.OnClick += OnDeletePropertyHandler; toolBar.AddItem(deleteButton); var deleteMenuButton = new ContextMenuItem(view); deleteMenuButton.SetText(Resources.DocumentSchemaDesignerDeleteButton); deleteMenuButton.SetImage("Actions/Delete_16x16"); deleteMenuButton.SetHotkey("Ctrl+Delete"); deleteMenuButton.OnClick += OnDeletePropertyHandler; contextMenu.AddItem(deleteMenuButton); // Separator1 var separator1 = new ToolBarSeparatorItem(view); toolBar.AddItem(separator1); var menuSeparator1 = new ContextMenuItemSeparator(view); contextMenu.AddItem(menuSeparator1); // Cut var cutButton = new ToolBarButtonItem(view); cutButton.SetToolTip(Resources.DocumentSchemaDesignerCutButtonToolTip); cutButton.SetImage("Actions/Cut_16x16"); cutButton.SetHotkey("Ctrl+X"); cutButton.OnClick += OnCutPropertyHandler; toolBar.AddItem(cutButton); var cutMenuButton = new ContextMenuItem(view); cutMenuButton.SetText(Resources.DocumentSchemaDesignerCutButton); cutMenuButton.SetImage("Actions/Cut_16x16"); cutMenuButton.SetHotkey("Ctrl+X"); cutMenuButton.OnClick += OnCutPropertyHandler; contextMenu.AddItem(cutMenuButton); // Copy var copyButton = new ToolBarButtonItem(view); copyButton.SetToolTip(Resources.DocumentSchemaDesignerCopyButtonToolTip); copyButton.SetImage("Actions/Copy_16x16"); copyButton.SetHotkey("Ctrl+C"); copyButton.OnClick += OnCopyPropertyHandler; toolBar.AddItem(copyButton); var copyMenuButton = new ContextMenuItem(view); copyMenuButton.SetText(Resources.DocumentSchemaDesignerCopyButton); copyMenuButton.SetImage("Actions/Copy_16x16"); copyMenuButton.SetHotkey("Ctrl+C"); copyMenuButton.OnClick += OnCopyPropertyHandler; contextMenu.AddItem(copyMenuButton); // Paste var pasteButton = new ToolBarButtonItem(view); pasteButton.SetToolTip(Resources.DocumentSchemaDesignerPasteButtonToolTip); pasteButton.SetImage("Actions/Paste_16x16"); pasteButton.SetHotkey("Ctrl+V"); pasteButton.OnClick += OnPastePropertyHandler; toolBar.AddItem(pasteButton); var pasteMenuButton = new ContextMenuItem(view); pasteMenuButton.SetText(Resources.DocumentSchemaDesignerPasteButton); pasteMenuButton.SetImage("Actions/Paste_16x16"); pasteMenuButton.SetHotkey("Ctrl+V"); pasteMenuButton.OnClick += OnPastePropertyHandler; contextMenu.AddItem(pasteMenuButton); // Separator2 var separator2 = new ToolBarSeparatorItem(view); toolBar.AddItem(separator2); var menuSeparator2 = new ContextMenuItemSeparator(view); contextMenu.AddItem(menuSeparator2); // MoveUp var moveUpButton = new ToolBarButtonItem(view); moveUpButton.SetToolTip(Resources.DocumentSchemaDesignerMoveUpButtonToolTip); moveUpButton.SetImage("Actions/MoveUp_16x16"); moveUpButton.SetHotkey("Alt+Up"); moveUpButton.OnClick += OnMoveUpPropertyHandler; toolBar.AddItem(moveUpButton); var moveUpMenuButton = new ContextMenuItem(view); moveUpMenuButton.SetText(Resources.DocumentSchemaDesignerMoveUpButton); moveUpMenuButton.SetImage("Actions/MoveUp_16x16"); moveUpMenuButton.SetHotkey("Alt+Up"); moveUpMenuButton.OnClick += OnMoveUpPropertyHandler; contextMenu.AddItem(moveUpMenuButton); // MoveDown var moveDownButton = new ToolBarButtonItem(view); moveDownButton.SetToolTip(Resources.DocumentSchemaDesignerMoveDownButtonToolTip); moveDownButton.SetImage("Actions/MoveDown_16x16"); moveDownButton.SetHotkey("Alt+Down"); moveDownButton.OnClick += OnMoveDownPropertyHandler; toolBar.AddItem(moveDownButton); var moveDownMenuButton = new ContextMenuItem(view); moveDownMenuButton.SetText(Resources.DocumentSchemaDesignerMoveDownButton); moveDownMenuButton.SetImage("Actions/MoveDown_16x16"); moveDownMenuButton.SetHotkey("Alt+Down"); moveDownMenuButton.OnClick += OnMoveDownPropertyHandler; contextMenu.AddItem(moveDownMenuButton); _treeView = treeView; _addButton = addButton; _addMenuButton = addMenuButton; Control.Content = mainPanel.GetControl(); // Пустое дерево модели данных SetValue(null); }