Reputation: 69
I have a rich text box which allows users to input text. What I want is some predefined sentences (which can't be edited) that can be dragged into the Rich text box. Does anyone know of a way that this can be done.
This is a WPF application so im using XAML.
Upvotes: 0
Views: 289
Reputation: 3764
What Rudi said but also, if you are looking to have the sentences visually dragged, as slightly transparent blocks of text, then you need to look into specifying an Adorner during the drag and drop process. There is a good example here. The example is ListView-specific but could be quite easily customised for your rich text box.
Upvotes: 0
Reputation: 21979
Enable AllowDrop
on your RichTextBox
and capture the Drop
event (or it might be PreviewDrop
on RTB).
You can then do whatever you want with it. Such as creating a Label that allows you to drag it into the RTB.
Drag/Drop in WPF is covered here on MSDN.
Upvotes: 1