DragDropBehavior not bindable, should inherit from FrameworkElement

4 posts, 0 answers
  1. jstevenson72
    jstevenson72 avatar
    3 posts
    Member since:
    Aug 2006

    Posted 04 Apr 2013 Link to this post

    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
  2. Nick
    Admin
    Nick avatar
    593 posts

    Posted 09 Apr 2013 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. jstevenson72
    jstevenson72 avatar
    3 posts
    Member since:
    Aug 2006

    Posted 09 Apr 2013 Link to this post

    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
  5. Nick
    Admin
    Nick avatar
    593 posts

    Posted 10 Apr 2013 Link to this post

    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.

Back to Top