How to make the equivalent of Graphics.DrawString () in WPF?

I am building a WPF application (in C #) and I need to be able to draw strings using C # code, not XAML. Lines will change quickly, so any method I use should be able to reflect this. I like the graphics.drawstring method on windows forms. Is there something similar that I can use in WPF?

Edit: Creating a FormattedText seems to be the answer, but what is drawContext? How to find him? What I really want to do is put this text in the children of the canvas. How it's done?

+4
source share
1 answer

There is an entire MSDN section explaining how to format rich text in WPF . This allows you to draw through code in any drawing context.

+1
source

All Articles