Adding combobox to Ribbon Control in XAML

Posted by  jayprakash sharma
 2902  View(s)
Rate this:

I have a WPF Application with a Ribbon Control. I want to add a ComboBox, to show the logged in user next to the help button. But when I try to add the ComboBox, it is created as a Tab.

        <RowDefinition Height="Auto"/>
    <Ribbon x:Name="RibbonWin" SelectedIndex="0" Margin="0,0,0,113">
            <RibbonButton SmallImageSource="Images\help.png"></RibbonButton>
            <ComboBoxItem Content="Test1"/>
        <RibbonTab Header="Home" KeyTip="H" Margin="0,0,0,-1" >
            <RibbonGroup x:Name="ClipboardGroup" Header="Clipboard">
                <RibbonMenuButton LargeImageSource="Images\paste.jpg"Label="Paste" KeyTip="V">
                    <RibbonMenuItem ImageSource="Images\paste.jpg"Header="Keep Text Only" KeyTip="T"/>
                    <RibbonMenuItem ImageSource="Images\paste.jpg"Header="Paste Special..." KeyTip="S"/>
                <RibbonButton SmallImageSource="Images\cut.jpg"Label="Cut" KeyTip="X" />
                <RibbonButton SmallImageSource="Images\copy.jpg"Label="Copy" KeyTip="C" />
            <RibbonGroup x:Name="Questions" Header="Questions And Answers">
                <RibbonMenuButton LargeImageSource="Images\Question.jpg"Label="Questions" KeyTip="V">
                    <RibbonMenuItem ImageSource="Images\paste.jpg" Header="Add Question" KeyTip="T"/>
                    <RibbonMenuItem ImageSource="Images\paste.jpg" Header="Paste Special..." KeyTip="S"/>
                <RibbonButton SmallImageSource="Images\Save.jpg" Label="Save" KeyTip="X" />
                <RibbonButton SmallImageSource="Images\Add.jpg" Label="Add" KeyTip="C" />
        <RibbonTab Header="Insert" KeyTip="I">
        <RibbonTab Header="PageLayout" KeyTip="L">

Also is there a way to remove the the Application Menu ComboBox on the left that is created by default.

  1. Re: Adding combobox to Ribbon Control in XAML

    Hi Jay, 

    Put a RibbonApplicationMenu into the ApplicationMenu-property and set its Visibility to 'Collapsed'. This will not remove the application menu, but at least it is not longer visible. There is not other way to hide it.

    The ComboBox must be inserted into a RibbonTab, so a RibbonTab will be created implicitly if you do not specify anyone.

    The following example demonstrates how to hide the application menu and insert a combo box:

            <RibbonApplicationMenu Visibility="Collapsed"></RibbonApplicationMenu>

      Modified On Apr-04-2018 06:00:19 AM