ComboBox - MaxDropDownHeight seems to be limited to 15 items - WinUI 3

youki 996 Reputation points
2023-01-16T22:39:45.4133333+00:00

I would like to have the ComboBox's dropdown as long as it gets depending on the available space on the screen that the user has less scrolling; faster access.

I've tested it:

  • If i have the ComboBoxItems tags in the xaml code directly and i set the MaxDropDownHeight to for i.e. 10000, it shows one more item, 15.
  • If i generate the CombobBoxItems by ViewModel and a template, it shows 2 more items, 15.

So the dropdown is in general 1 item shorter generated by a template.

  • I've also set MaxDropDownHeight in the app.xaml from the generic.xaml, this has the same behaviour.
  • I've tried to set the OpenedLength of the dropdown in the app.xaml but that defines only the drawing.

I can't find any infos about it, is this the restriction?

Windows.UI.Xaml.Controls.ComboBox.MaxDropDownHeight

ADDENDUM:

There is no Auto option.

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
725 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,527 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
764 questions
{count} votes

Accepted answer
  1. Junjie Zhu - MSFT 14,751 Reputation points Microsoft Vendor
    2023-01-17T09:08:36.67+00:00

    Hello,

    Welcome to Microsoft Q&A!

    This is not a bug.

    In ComboBox resource , ComboBox is designed to display a maximum of 15 item.

    <x:Int32 x:Key="ComboBoxPopupMaxNumberOfItems">15</x:Int32> 
    

    If you want to change the max number of items, you can override ComboBoxPopupMaxNumberOfItems in App.xmal, and set the appropriate MaxDropDownHeight in ComboBox.

    <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
                    <!-- Other merged dictionaries here -->
                </ResourceDictionary.MergedDictionaries>
                <!-- Other app resources here -->
                <x:Int32 x:Key="ComboBoxPopupMaxNumberOfItems">20</x:Int32>
            </ResourceDictionary>
    </Application.Resources>
    

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful