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