This is a migrated thread and some comments may be shown as answers.

DragDropBehavior not bindable, should inherit from FrameworkElement

3 Answers 58 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
jstevenson72
Top achievements
Rank 1
jstevenson72 asked on 04 Apr 2013, 02:51 PM
I am trying to create a universal Behavior for my application for DragNDrop using your infrastructure.

I would like to bind an items datacontext to a property of my DragDropBehavior but your abstract class inherits from DependencyObject instead of FrameworkElement so it doesn't work.

Can you change this class:
public abstract class DragDropBehavior<TState> : DependencyObject, IDragDropBehavior<TState> where TState : DragDropState

To this in the future:
public abstract class DragDropBehavior<TState> : FrameworkElement, IDragDropBehavior<TState> where TState : DragDropState

3 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 09 Apr 2013, 08:27 AM
Hi Jason,

You can accomplish that by implementing the IDragDropBehavior interface and inheriting from FrameworkElement, which should give you the functional requirements that you have. 

Let me know if you need any help doing it! 

Greetings,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
jstevenson72
Top achievements
Rank 1
answered on 09 Apr 2013, 03:36 PM
I had coded up a whole class doing just that but I couldn't figure out how to get it to work in the Xaml.

Do you have an example that shows how to apply a behavior from a Custom Class that implements IDragDropBehavior interface?

Also would I lose the built in Adorner logic, or does that come along for free?

Thanks,

Jason
0
Nick
Telerik team
answered on 10 Apr 2013, 08:23 AM
Hello Jason,

Unfortunately the Generig DragDropBehavior class cannot be used directly in XAML this is a limitation of the framework itself. To use it there you have to inherit from the generic class and use the derived class definition instead. 

As to the adorner logic, I am not sure to what you are referring exactly. Can you clarify?

Looking forward to your reply! 

Regards,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
DragAndDrop
Asked by
jstevenson72
Top achievements
Rank 1
Answers by
Nick
Telerik team
jstevenson72
Top achievements
Rank 1
Share this question
or