Search code examples
c#wpfcomboboxribbon

RibbonComboBox has no selectionChanged event


I have a combo box in my program and it works as it should

However I want this to be a part of my ribbon in my WPF application

I have created a 'ribbon combo box', however this does not seem to have a selection changed event, like the normal combo box does

Why is this?

If I cut and paste the code from my standard combo box into a ribbon group, the box is created however it is empty when I run the program

Also the only way I can run the program is by commenting out the code within my if statement (for what I want to happen based on the combo box selection)


Solution

  • If you are using the Microsoft Ribbon for WPF, the SelectionChanged event can be found in the RibbonGallery

    <ribbon:RibbonComboBox Style="{StaticResource SubPosition}" SelectionBoxWidth="20" IsEditable="True">
        <ribbon:RibbonGallery Name="rbngFontSizes" SelectedValue="11" SelectedValuePath="Content" SelectionChanged="rbngFontSizes_SelectionChanged">
            <ribbon:RibbonGalleryCategory ItemsSource="{Binding}" />
        </ribbon:RibbonGallery>
    </ribbon:RibbonComboBox>