ComboBox Scrollbar

Mar 12, 2009 at 8:02 PM
Hi Tom,

I would like to first thank you for this generous contribution of Odyssey.RibbonBar; it's pretty amazing in my books :D  After working with the RibbonBar and most of its features, I have come across only one problem.  When it comes to RibbonCombobox, if you have a lot of items (using combobox to display all the font families on my computer) the scrollbar does not show up, is this a bug or just human error?  The code snippets can be found below.

I should point out that I tried the same approach using a simple WPF combobox, and the scrollbar was present by default.

Thanks for your help in advance,

Armand

[code snippets]

[xaml]

 

...
xmlns
:local="clr-namespace:Neuro"

 

 

Title="Main Window" Height="400" Width="800">

 

 

 

<odc:RibbonWindow.Resources>

 

 

 

<local:ThumbnailConverter x:Key="ThumbnailConverter"/>

 

 

 

<local:FontNameList x:Key="InstalledFonts"/>

 

 

 

</odc:RibbonWindow.Resources>

 

.....

 

 

<StackPanel Orientation="Horizontal">

 

 

 

<odc:RibbonComboBox Name="fontFamily"

 

 

FontSize="12"

 

 

ItemsSource="{StaticResource InstalledFonts}"

 

 

SelectedIndex="0"

 

 

MaxDropDownHeight="100"/>

 

 

 

<odc:RibbonComboBox Name="fontSizes"/>

 

 

 

</StackPanel>

 



[C#]

 

public class FontNameList : System.Collections.Generic.List<RibbonComboBoxItem>
{
    public FontNameList()
    {
        
using (InstalledFontCollection fonts = new InstalledFontCollection()
        {

 

 

            foreach (System.Drawing.FontFamily font in fonts.Families)
           {

 

 

               RibbonComboBoxItem item = new RibbonComboBoxItem();
               item.FontFamily =
new System.Windows.Media.FontFamily(font.Name);
               item.FontSize = 12;
               item.Content = font.Name;
              
base.Add(item);

 

           }

       }

   }

}