title: Some wpf Font_Combobox questions
body: <p>I have this code:</p>
  
  <pre><code>  &lt;ComboBox Width="100" ItemsSource="{Binding FontList}" x:Name="fontComboFast"&gt;
                          &lt;ComboBox.ItemsPanel&gt;
                              &lt;ItemsPanelTemplate&gt;
                                  &lt;VirtualizingStackPanel /&gt;
                              &lt;/ItemsPanelTemplate&gt;
                          &lt;/ComboBox.ItemsPanel&gt;
                          &lt;ComboBox.ItemTemplate&gt;
                              &lt;DataTemplate&gt;
                                  &lt;TextBlock Text="{Binding}" FontFamily="{Binding }" FontSize="12" /&gt;
                              &lt;/DataTemplate&gt;
                          &lt;/ComboBox.ItemTemplate&gt;
                      &lt;/ComboBox&gt;
  </code></pre>
  
  <p>There are 3 gotchas in that Combobox.</p>
  
  <ol>
  <li>The Items/fonts have a different height</li>
  <li>When I scroll up/down the scrollviewer`s width increases/decreases depending on the Length of the longest visible item in the scrollviewer. How can I set a fixed width?</li>
  <li>The fonts aka TextBlocks are not vertically centered</li>
  </ol>
  
  <p>How can I change those 3 things?</p>
  
  <p><strong>UPDATE</strong>:</p>
  
  <pre><code> &lt;ComboBox AlternationCount="2" Width="200"  ItemContainerStyle="{StaticResource alternateColor}" ItemsSource="{Binding Source={x:Static Member=Fonts.SystemFontFamilies}}" x:Name="fontComboFast"&gt;
  
  &lt;Style x:Key="alternateColor" TargetType="{x:Type ComboBoxItem}"&gt;
              &lt;Style.Setters&gt;
                  &lt;Setter Property="Height" Value="30" /&gt;
                  &lt;Setter Property="VerticalContentAlignment" Value="Center" /&gt;
                  &lt;Setter Property="FontSize" Value="16" /&gt;
              &lt;/Style.Setters&gt;
              &lt;Style.Triggers&gt;                
                  &lt;Trigger Property="ItemsControl.AlternationIndex" Value="0"&gt;
                      &lt;Setter Property="Background" Value="LightGray"/&gt;
                  &lt;/Trigger&gt;
                  &lt;Trigger Property="ItemsControl.AlternationIndex" Value="1"&gt;
                      &lt;Setter Property="Background" Value="AliceBlue"/&gt;
                  &lt;/Trigger&gt;                
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
  </code></pre>
  
  <p>Hm 2 of 3 answers were right and they were the easiest ones is this now a solution? :O
  You have some cool combobox tips in store? Then I would mark it as solution else you get a point ;-)</p>
  
  <p>btw. congrats to your new wpf job read it on your blog, I envy you!</p>