Member 10913969 wrote:
I think I'm going to can this question as it really hasn't come across properly! of course I can drop a richtext on a canvas in design mode and edit it!
Only after this comment I got an idea what your real problem could be. Probably, this is some confusion on how to write code equivalent to some XAML. And, instead of digging into the detail specific to
Canvas
or
RichTextBox
(or whatever else you are asking about), I want to give you the most universal advise which would work in nearly all cases.
First thing to understand is: when you use XAML at design time to create a window or a user control, it is fully consumed during design time and later during build time. When you build your project with such XAML, the XAML code is fully translated into C# code. When the build is complete, this auto-generated code stays under the sub-directory of your project, "obj", you can easily find it.
So, here is my universal advice: if you can do something in XAML or with the designer and not sure how to write similar thing in C# (which is really can be a good way of development, in very many cases), you can do simple thing: in some sample project, do whatever you wanted to do in XAML, build this project, find out auto-generated files and see what this code does. Simple, isn't it? Such exercises are really useful for understanding certain things.
—SA