Back to Home
Bind System Font Families to Combo Box in XAML.
May 05, 2012 • 1 minute read

Populating the WPF ComboBox with System Font Families is so easy and can be done in XAML without code behind.
<ComboBox x:Name="fonts"
Width="200"
ItemsSource="{Binding Source={x:Static Member=Fonts.SystemFontFamilies}}" />
Also to show each Font Item with its own corresponding Font Family, just modifying the Item template will make the magic.
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontFamily="{Binding}"/>
</DataTemplate>
</ComboBox.ItemTemplate>