Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8271609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:53:35+00:00 2026-06-08T06:53:35+00:00

I use the Ribbon for WPF (2010 – Microsoft.Windows.Controls.Ribbon ). When Ribbon.IsMinimized is set

  • 0

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

When Ribbon.IsMinimized is set to true the ribbon is minimized.

The normal behavior is that when I click on a minimized tab, it will open temporarily. But is there any way to disable that, to prevent it from expanding?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T06:53:37+00:00Added an answer on June 8, 2026 at 6:53 am

    Please see the code below. Am not entirely clear on what you want, but I have covered 2 possible behavioural cases which hopefully meets your needs.

    • Case 1:

      If the Ribbon is set to minimized and you click on a Ribbon tab, it will turn off the minimized flag, and turn the Ribbon into a non-minimized one from that point on. You can double-click the tab, or select the minimize Ribbon from the context menu to minimize again.

    • Case 2:

      If you click on a Ribbon tab when the Ribbon is minimized it will keep the Ribbon in the minimized state.

    I have provided 2 implementations of the code, one that just hooks a regular Ribbon, and another that creates a derived Ribbon.

    <Window x:Class="DemoOfRibbonWithDifferentMinimizeBehaviour.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            x:Name="Main"
            Title="MainWindow" Height="350" Width="525" xmlns:my="http://schemas.microsoft.com/winfx/2006/xaml/presentation/ribbon">
        <Grid>
            <my:Ribbon Height="254" HorizontalAlignment="Left" Name="ribbon1" VerticalAlignment="Top" Width="503" ItemsSource="{Binding}" IsMinimized="True" IsCollapsed="False" IsDropDownOpen="False" Loaded="ribbon1_Loaded">
                <my:RibbonTab Header="Fruits" KeyTip="F">
                    <my:RibbonGroup Header="Berries">
                        <my:RibbonButton Label="Grapes"/>
                        <my:RibbonButton Label="Bananas"/>
                    </my:RibbonGroup>
                    <my:RibbonGroup Header="Pome">
                        <my:RibbonButton Label="Apple"/>
                        <my:RibbonButton Label="Pears"/>
                    </my:RibbonGroup>
                </my:RibbonTab>
                <my:RibbonTab Header="Vegetables" KeyTip="V">
                    <my:RibbonGroup Header="Root">
                        <my:RibbonButton Label="Carrot"/>
                        <my:RibbonButton Label="Turnips"/>
                    </my:RibbonGroup>
                    <my:RibbonGroup Header="Stalk">
                        <my:RibbonButton Label="Bamboo"/>
                        <my:RibbonButton Label="Celery"/>
                    </my:RibbonGroup>
                </my:RibbonTab>
                <my:RibbonCheckBox Label="Prevent Maximize" IsChecked="{Binding ElementName=Main, Path=PreventMaximize}">Prevent Maximize</my:RibbonCheckBox>
            </my:Ribbon>
        </Grid>
    </Window>
    

    Code behind of Window:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using Microsoft.Windows.Controls.Ribbon;
    using System.Windows.Controls.Primitives;
    using System.ComponentModel;
    
    namespace DemoOfRibbonWithDifferentMinimizeBehaviour
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            Popup template_PART_ITEMSPRESENTERPOPUP;
    
            public bool PreventMaximize { get; set; }
    
            public MainWindow()
            {
                PreventMaximize = true;
    
                InitializeComponent();
            }
    
            private void ribbon1_Loaded(object sender, RoutedEventArgs e)
            {
                template_PART_ITEMSPRESENTERPOPUP = VisualHelper.FindChild<Popup>(ribbon1, "PART_ITEMSPRESENTERPOPUP");
    
                if (template_PART_ITEMSPRESENTERPOPUP != null)
                {
                    template_PART_ITEMSPRESENTERPOPUP.Height = 0;
                    template_PART_ITEMSPRESENTERPOPUP.StaysOpen = false;
                    template_PART_ITEMSPRESENTERPOPUP.Opened += new EventHandler(template_PART_ITEMSPRESENTERPOPUP_Opened);
                }
            }
    
            void template_PART_ITEMSPRESENTERPOPUP_Opened(object sender, EventArgs e)
            {
                if (ribbon1.IsMinimized)
                {
                    ribbon1.IsMinimized = false;
                    ribbon1.IsDropDownOpen = false;
    
                    template_PART_ITEMSPRESENTERPOPUP.Visibility = System.Windows.Visibility.Collapsed;
                }
    
                // Uncomment this if your intention is to prevent the Ribbon being maximized
                // i.e. keep it fixed in minimized mode.
                if (PreventMaximize)
                {
                    ribbon1.IsMinimized = true;
                }
            }
        }
    
        //--------------------------------------------------------------------------
    
        // If you want to encapsulate the new behaviour in a new Ribbon class, then you
        // could use this instead of the above and modify your XAML appropriately.
    
        public class RibbonWhichPreventsMaximize : Ribbon
        {
            Popup template_PART_ITEMSPRESENTERPOPUP;
            EventHandler popupeventhandler;
    
            public RibbonWhichPreventsMaximize()
            {
                popupeventhandler = new EventHandler(template_PART_ITEMSPRESENTERPOPUP_Opened);
            }
    
            public override void OnApplyTemplate()
            {
                // Unwire the handler if this Ribbon control is getting a new Template applied
                // (e.g. for case when Template is dynamically changed at runtime).
    
                if (template_PART_ITEMSPRESENTERPOPUP != null)
                {
                    template_PART_ITEMSPRESENTERPOPUP.Opened -= popupeventhandler;
                }
    
                base.OnApplyTemplate();
    
                template_PART_ITEMSPRESENTERPOPUP = VisualHelper.FindChild<Popup>(this, "PART_ITEMSPRESENTERPOPUP");
    
                if (template_PART_ITEMSPRESENTERPOPUP != null)
                {
                    template_PART_ITEMSPRESENTERPOPUP.Height = 0;
                    template_PART_ITEMSPRESENTERPOPUP.StaysOpen = false;
                    template_PART_ITEMSPRESENTERPOPUP.Opened += popupeventhandler;
                }
            }
    
            void template_PART_ITEMSPRESENTERPOPUP_Opened(object sender, EventArgs e)
            {
                if (this.IsMinimized)
                {
                    this.IsMinimized = false;
                    this.IsDropDownOpen = false;
    
                    template_PART_ITEMSPRESENTERPOPUP.Visibility = System.Windows.Visibility.Collapsed;
                }
    
                // Uncomment this if your intention is to prevent the Ribbon being maximized
                // i.e. keep it fixed in minimized mode.
                this.IsMinimized = true;
            }
        }
    
        //--------------------------------------------------------------------------
    
        // Note this routine taken from:
        // http://stackoverflow.com/questions/7034522/how-to-find-element-in-visual-tree-wp7
    
        public static class VisualHelper
        {
            public static T FindChild<T>(DependencyObject parent, string childName)
                where T : DependencyObject
            {
                // Confirm parent and childName are valid. 
                if (parent == null)
                {
                    return null;
                }
    
                T foundChild = null;
    
                int childrenCount = VisualTreeHelper.GetChildrenCount(parent);
                for (int i = 0; i < childrenCount; i++)
                {
                    DependencyObject child = VisualTreeHelper.GetChild(parent, i);
                    // If the child is not of the request child type child
                    var childType = child as T;
                    if (childType == null)
                    {
                        // recursively drill down the tree
                        foundChild = FindChild<T>(child, childName);
    
                        // If the child is found, break so we do not overwrite the found child. 
                        if (foundChild != null)
                        {
                            break;
                        }
                    }
                    else if (!string.IsNullOrEmpty(childName))
                    {
                        var frameworkElement = child as FrameworkElement;
                        // If the child's name is set for search
                        if (frameworkElement != null && frameworkElement.Name == childName)
                        {
                            // if the child's name is of the request name
                            foundChild = (T)child;
                            break;
                        }
    
                        // Need this in case the element we want is nested
                        // in another element of the same type
                        foundChild = FindChild<T>(child, childName);
                    }
                    else
                    {
                        // child element found.
                        foundChild = (T)child;
                        break;
                    }
                }
    
                return foundChild;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF windows application that uses the ms ribbon control for the
I need to convert my WPF application, which has a Ribbon , to use
I'm trying to open the sample Solution for the Microsoft Ribbon for WPF, but
In Microsoft Ribbon Control, there is RibbonRadioButton where we can use on the Ribbon
I've noticed that when I use TRibbon control that comes with Delphi 2010, it
Does Microsoft have ribbon control for non-Office applications? If not is there any that
I see the majority of WPF Ribbon examples out there use some code like
I'm using the WPF ribbon control with some success; I'm trying now to use
Soon Windows 7 will use ribbon as default interface in any Windows programs, like
Has anybody tried to use the native windows 7 ribbon control in a WTL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.