views:

361

answers:

1

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?

A: 

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.

Reed Copsey
Ok, I understand how to create a FormattedText, but how do I put it into the children of a canvas?
Stefan