Exemplo n.º 1
0
        private void OnSwitchUIButtonClick(NEventArgs arg)
        {
            NButton switchUIButton = (NButton)arg.TargetNode;
            NLabel  label          = (NLabel)switchUIButton.Content;

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

            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_RichText);
            }
            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 NRichTextCommandBarBuilder();
                }

                m_ExampleTabPage.Content = m_CommandBarBuilder.CreateUI(m_RichText);
            }
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            base.Initialize();

            // Add the custom command action to the rich text view's commander
            m_RichText.Commander.Add(new CustomCommandAction());

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

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

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