Search code examples
wpfribbondouble-clickminimizemaximize

Disable minimize or maximize when double clicked on ribbon


I use the Ribbon for WPF (2010 - Microsoft.Windows.Controls.Ribbon).

How can I disable the minimize or maximize effect from the red range, when I do a double click on the tab (header)

enter image description here


Solution

  • Use this event on the SizeChanged property of the ribbon to suppress minimizing.

    /// <summary>
    /// Disable the minimize functionality of the ribbon.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void RibbonSizeChanged(object sender, SizeChangedEventArgs e)
    {
        var ribbon = sender as Ribbon;
        if (ribbon != null)
        {
            ribbon.IsMinimized = false;
        }
    
        // Handled
        e.Handled = true;
    }