Live Chat Icon For mobile
Live Chat Icon

How do you bind the available system fonts to a combobox and bind to the selection?

Platform: WPF| Category: Binding Techiniques

You can do so as follows:


<ComboBox Name='fontCombo' ItemsSource='{x:Static Fonts.SystemFontFamilies}'  />
<!--And bind the TextBlock.FontFamily to the selected item of the above combo as follows -->
<TextBlock 
   Text='Something'
   FontFamily='{Binding ElementName=fontCombo, Path=SelectedItem}'
/>

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.