private void OnSwitchUIButtonClick(NEventArgs arg)
        {
            NButton switchUIButton = (NButton)arg.TargetNode;
            NLabel  label          = (NLabel)switchUIButton.Content;

            // Remove the rich text view from its parent
            m_DrawingView.ParentNode.RemoveChild(m_DrawingView);

            if (label.Text == SwitchToRibbon)
            {
                // We are in "Command Bars" mode, so switch to "Ribbon"
                label.Text = SwitchToCommandBars;

                // Create the ribbon
                m_ExampleTabPage.Content = m_RibbonBuilder.CreateUI(m_DrawingView);
            }
            else
            {
                // We are in "Ribbon" mode, so switch to "Command Bars"
                label.Text = SwitchToRibbon;

                // Create the command bars
                if (m_CommandBarBuilder == null)
                {
                    m_CommandBarBuilder = new NDiagramCommandBarBuilder();
                }

                m_ExampleTabPage.Content = m_CommandBarBuilder.CreateUI(m_DrawingView);
            }
        }
Beispiel #2
0
        public override void Initialize()
        {
            base.Initialize();

            // Add the custom command action to the drawing view's commander
            m_DrawingView.Commander.Add(new CustomCommandAction());

            // Remove the "Edit" menu and insert a custom one
            m_CommandBarBuilder = new NDiagramCommandBarBuilder();
            m_CommandBarBuilder.MenuDropDownBuilders.Remove(NDiagramCommandBarBuilder.MenuEditName);
            m_CommandBarBuilder.MenuDropDownBuilders.Insert(1, new CustomMenuBuilder());

            // Remove the "Standard" toolbar and insert a custom one
            m_CommandBarBuilder.ToolBarBuilders.Remove(NDiagramCommandBarBuilder.ToolbarStandardName);
            m_CommandBarBuilder.ToolBarBuilders.Insert(0, new CustomToolBarBuilder());

            // Remove the drawing view from its parent and recreate the command bar UI
            m_DrawingView.ParentNode.RemoveChild(m_DrawingView);
            m_ExampleTabPage.Content = m_CommandBarBuilder.CreateUI(m_DrawingView);
        }