Question ComboBox's MaxDropDownHeight Property Isn't Working

glasswizzard

Well-known member
Joined
Nov 22, 2019
Messages
126
Programming Experience
Beginner
So I hear that the length of the comboBox's drop down list can be changed with the MaxDropDownHeight property. Unfortunarly for me it does nothing at all, maybe I'm using the wrong property? Here is the code relating to the ComboBox:

C#:
<ComboBox x:Name="ProfileComboBox" Width="Auto" IsReadOnly="True" SelectionChanged="ProfileComboBox_SelectionChanged"
          Foreground="{StaticResource ForegroundBrush}" Style="{DynamicResource ProfileComboBoxStyle}">

C#:
ProfileList = new List<string>();
ProfileComboBox.ItemsSource = (IEnumerable<string>)ProfileList;

I'm thinking it may have something to do with me overriding the style perhaps?
 
Or the fact that you're not using it at all, since I don't see it anywhere in your code, so its kinda hard to know what you're doing wrong when I can't see how or where you implemented it.

The default value can be overridden, but I don't know if it can be done VIA the style, but I'd like to think not.

What value were you applying when setting the property?
 
I ended up removing the combobox because of this issue so I can't provide more code. However I just started a brand new WPF project and put a combobox on the window. No matter what changes I make to the MaxDropDownProperty the dropdown list never changes size, so this is something deeper then the code.

As for the values I've tried, many different numbers, the default is 360, I've tried anything from 50 to 5000, nothing ever makes a difference.
 
Please don't delude answering my questions with trivial writing. I asked how you set it, and therein implied you show me how you done it?>

Firstly, you should be running .net core 3.0 ComboBox.MaxDropDownHeight Property (System.Windows.Controls)

You are also meant to assign a double value. Try following it as done on the example. Saying it doesn't work, and now showing us what you tried is a waste of a post, and doesn't tell us anything.
 
I don't know how to use .net core 3, my target frameworks are all versions of .net framework, not .net core.

I can no longer show any implementation, it doesn't exist. When this thread didn't get any replies for a while I figured no one could/would answer and so I removed the combobox. This kinda made the thread pointless but I can't delete posts so I don't know what to do in that situation.

I was setting it in the properties panel of visual studio. This seems to have no effect but when I set it in the XAML it works (testing on a new blank app). That was the issue, I'll try to remember to set everything in XAML from now on.
 
I just realized why I couldn't see .net core. I'm very stupid yes, but I've been making .net framework wpf apps without realizing it. From now on, I'll choose .net core instead. Such a simple thing but I didn't know it.
 
Last edited:
Back
Top Bottom