Search code examples
wpfribbon-control

How to disable hide/unhide in WPF Ribbon Control


I am using the latest Ribbon Control from MS. When one double click the Tab Header, the whole Ribbon will hide the content and show only the header text. I want to disable this hide/unhide feature. So even if user double click Tab Header, the Ribbon remain as it is.

I think it should be the OnMouseDoubleClick Event in RibbonTab but have no clue how to override it. Am I suppose to give it a x:Name to each and every RibbonTab then write an empty method ribbonTab1_OnMouseDoubleClick to each Ribbon Tab?


Solution

  • Use the PreviewMouseDoubleClick event in the Ribbon:

    PreviewMouseDoubleClick="ribbon_PreviewMouseDoubleClick"
    

    and then in the handler, mark the event as handled:

    private void ribbon_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
        e.Handled = true;
    }