How do I set the font of a TextBox from a string in the code behind?
TextBox
string
// example txtEditor.FontFamily = "Consolas";
Copy and paste your example code into the constructor of the form, right after InitializeComponent();
InitializeComponent();
public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); txtEditor.FontFamily = new FontFamily("Consolas"); } }