WPF and Silverlight Edition Basic Library / Combo Box / ComboBox Features / Drop-Down List / Setting the Maximum Height and Width
Setting the Maximum Height and Width

By default, the size of the drop-down list is determined by the width of the widest C1ComboBoxItem item and the collective height of all of the C1ComboBoxItem items, as the DropDownWidth and DropDownHeight properties are both set to NaN.

You can control the maximum width and maximum height of the drop-down list by setting the C1ComboBox control's MaxDropDownWidth and MaxDropDownHeight properties. Setting these properties ensures that the area of the drop-down list can never expand to a larger area than you've specified. If the width or height of the list exceeds the specified maximum height and width, scrollbars will automatically be added to the drop-down list. 

Complete the following steps:

  1. Add MaxDropDownHeight="150" and MaxDropDownWidth="350" to the <c1:C1ComboBox> tag so that the markup resembles the following:
XAML
Copy Code
<c1:C1ComboBox HorizontalAlignment="Left" Width="249" MaxDropDownHeight="150" MaxDropDownWidth="350">.
  1. Run the program and click the combo box's drop-down arrow to see the result of your settings.