[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

WPF: Adorners for ContentElements, or other ways of extending RichTextBox

Pavel Minaev

10/1/2008 10:15:00 AM

I am considering using WPF RichTextBox as a base for a formatted text
editor in a future version of our application. It seems to do fine
with respect to features (can do lists, tables and images just fine),
and, impressively, handles copy-paste from Word and IE to the best of
its abilities. However, the major stumbling block so far is the lack
of inline editing of images and tables. Specifically, I want the user
to be able to click on the image/table, and use the mouse to resize it
and drag it around; and, in case of tables, to resize table rows/
columns that way as well. Interestingly, RichTextBox supports
drag&drop of images within the document out of the box, but resizing
is not there.

Since images are implemented via Image nested in BlockUIElement/
InlineUIElement, resizing for them is easy to do using adorners, and
there are a few forum posts on the Net explaining as much. But tables
seem to pose a much more difficult problem - they ultimately derive
from ContentElement and not from UIElement, and therefore they cannot
be adorned. It is possible to intercept mouse dragging via events, but
I don't see any way to override the rendering to provide visual cues
(resizing handles etc); also, it's not clear how to find out the
visible positions of the grid lines.

Any ideas? Or is it just not doable?