/// <summary>
        /// Invoked when an unhandled <see cref="UIElement.MouseUp"/> routed event is raised on this element.
        /// Implement this method to add class handling for this event.
        /// </summary>
        /// <param name="e">The event data for the <see cref="UIElement.MouseUp"/> event.</param>
        protected override void OnMouseUp(MouseButtonEventArgs e)
        {
            // Call the base method
            base.OnMouseUp(e);

            // If a selection was just made with the mouse and we are not in an XBAP...
            if ((e.ChangedButton == MouseButton.Left) && (!this.Selection.IsEmpty) && (!BrowserInteropHelper.IsBrowserHosted))
            {
                // Show the mini-toolbar
                MiniToolBarService.Show(new ActiproSoftware.ProductSamples.RibbonSamples.Common.RichTextBoxMiniToolBar(),
                                        this, e.GetPosition(this));
            }
        }
Ejemplo n.º 2
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // NON-PUBLIC PROCEDURES
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Occurs when the mouse button is released.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The event data for the <see cref="UIElement.MouseUp"/> event.</param>
        private void OnPreviewMouseUp(object sender, MouseButtonEventArgs e)
        {
            // If a selection was just made with the mouse...
            if ((e.ChangedButton == MouseButton.Left) && (!editor.Selection.IsEmpty))
            {
                // Get the mini-toolbar in the resources of this UserControl
                RibbonControls.MiniToolBar toolBar = (RibbonControls.MiniToolBar) this.FindResource("SimpleMiniToolBar");
                if (toolBar != null)
                {
                    // Show the mini-toolbar
                    MiniToolBarService.Show(toolBar, editor, e.GetPosition(editor));
                }
            }
        }