Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
405
How can I tell from the xaml object model if a control is drag-able?
posted

I have a xamTree in which I make the leaf nodes drag-able.  

I have silverlight acceptance tests that can look at the xamtree to validate it has the proper data, and I would like to validate it is drag-able.  Is there anyway to check if the dragsource/target is on an element?

  • 8831
    posted

    Hi,

    You can use DragDropManager.GetDragSource(DependencyObject) mehod. It returns the instance of the DragSource object attached to passed as parameter DependencyObject if any.
    If you have used data template to make items drag-able you need to examine the visual tree of the XamTreeItem instance in order to find visual child with DragSource object attached to it and then check the value of DragSource.IsDraggable property.

    Regards.
    Plamen.