

This means that we cannot use it in a list of font families with fallbacks or as a fallback itself. These keywords can be useful, but they also have some drawbacks, the main one being that they only work with the shorthand font property. Please don't ask several questions in the same thread.A few months ago, I wrote about how you can use system fonts in the browser using the built-in keywords that work with the font shorthand property (see Using System Fonts in the Browser).

Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. That makes it just 1 single line of extra code :) If you give the ComboBox an x:Name in the XAML markup you could also set the default value directly in the constructor of your window or user control: public MainWindow() I am afraid you cannot do this directly in the XAML markup but adding 2-4 lines of code in the view to select a default value is perfectly fine and probably a better solution than defining a class just for the purpose of being able to select private void ComboBox_Loaded(object sender, RoutedEventArgs e)Ĭmb.SelectedItem = new FontFamily("Segoe UI") The easiest way to do this is probably to handle the Loaded event for the ComboBox: You need to set the SelectedItem property of the ComboBox to an actual FontFamily object. If you lost the serialisation/deserialization stuff then that could be the default they get each time they start using your editor thing. Then that'll be what the user gets until they pick a different one. Propert圜hanged(this, new Propert圜hangedEventArgs(propertyName)) Public void RaisePropert圜hanged( String propertyName = "") Public event Propert圜hangedEventHandler Propert圜hanged Public class FontDetails : INotifyPropert圜hanged

If you change FontDetails to give a default font: namespace wpf_FontSize Or you could adapt it and the combo out of MainWindow. You could use that approach so the user picks the font family they prefer and they get that as default when they start again. The chosen setting is serialised to disk and deserialised on start up again. It's used on a window but you could of course use it at any level in your document instead.

That has a class FontDetails which is used to drive font settings. Thanks to the RichTextBox control, this FlowDocument is completely editable!īut if you have a further question on this please start a new thread and provide sufficient code or information to reproduce your issue. If I throw a richtextbox into my sample then it picks up the default font. What's a richtextbox got to do with selecting the default entry in a combobox?
