Skip to content

ComboBox dropdown is empty when expanding for the first time when specifying ItemsPanelTemplate in order to add Grouping #1228

@ottD

Description

@ottD

After upgrading from v9 to v10 of the Fluent.Ribbon library, we have noticed that the ComboBox control fails to render any items the first time a user is trying to expand the dropdown. Consecutive user interactions render the dropdown content as expected. We tracked this down to the ItemsPanelTemplate which we added a while ago (as described here (#309)) in order to support grouping of items using a Fluent:GalleryPanel (also see code sample below). Note that the issue goes away if we remove the custom ItemsPanelTemplate but then we lose the Grouping which we had with Fluent.Ribbon v9.
So is this still the recommended way of adding Grouping to comboBox items or is there another way in Fluent.Ribbon v10?

<Fluent:ComboBox Name="ViewComboBox" Height="Auto" HorizontalAlignment="Right" Size="Small" IsEditable="False" ScrollViewer.CanContentScroll="False"
                       ItemsSource ="{Binding Path=LocationViews, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type l:FileList}}}"
                       SelectedValue ="{Binding Path=SelectedView, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type l:FileList}}}"
                       SelectionChanged="ViewComboBox_OnSelectionChanged"
                       MinWidth= "150" MaxWidth="250" VerticalContentAlignment="Center" >
    <Fluent:ComboBox.ItemsPanel>
        <ItemsPanelTemplate>
            <Fluent:GalleryPanel IsGrouped="True" GroupBy="Group"
                                 ItemContainerGenerator="{Binding ItemContainerGenerator, RelativeSource={RelativeSource FindAncestor, AncestorType=Fluent:ComboBox}}" />
        </ItemsPanelTemplate>
    </Fluent:ComboBox.ItemsPanel>
</Fluent:ComboBox>

First click on comboBox shows no items in dropdown:
image

Closing the dropdown and clicking again on comboBox shows dropdown items with Grouping as expected :
image


Environment

  • Fluent.Ribbon v10.1.0
  • Windows 11
  • .NET Framework 4.8

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions