I'm creating a WPF application (in C#) and I need to be able to draw strings using the C# code, not the XAML. The strings will be changing rapidly, so whatever method I use should be able to reflect that. I like the graphics.drawstring method in windows forms. Is there anything similar I can use in WPF?
Edit: Creating FormattedText seems to be the answer, but what is the drawingContext? How do I find it? What I really want to do is put this text into the children of a canvas. How is that done?
There is an entire section of MSDN explaining how to draw formatted text in WPF. This allows you to draw, via code, on any drawing context.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With