tags:

views:

824

answers:

2

Hello,

Does anyone have an idea how I can disable Drag & Drop for all my TextBox Elements? I found something here , but that would need me to run a loop for all Elements..

Thank you!

EDIT

Thanks a lot for the help!

A: 

You can easily wrap what this article describes into a attached property/behaviours...

ie. TextBoxManager.AllowDrag="False" (For more information check out these 2 CodeProject articles - Drag and Drop Sample and Glass Effect Samplelink text)

Or try out the new Blend SDK's Behaviors

UPDATE

  • Also read this article by Bill Kempf about attached behaviors
  • And as kek444 pointed out in the comments, you then just create a default style for textbxo whit this attached property set!
rudigrobler
And of course, set the attached properties in a default style for the TextBox, if that is required to save some handwork.
kek444
A: 

Use the following after InitializeComponent()

DataObject.AddCopyingHandler(textboxName, (sender, e) => { if (e.IsDragDrop) e.CancelCommand(); });
Nitin Chaudhari