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
1735
Binding to View Model in DragSource and DragTemplate
posted

Hi,

I'm trying to get the Drag/Drop framework to work well in my Application, but have some issue with data binding.

Basically, I'm using the drag/drop framework on a the DataTemplates of a ListBox and I want the behaviour and look of drag/drop to use data from the underlying View Model.

1. I want e,g, to enable Drag/Drop based on a property of my View Model (DataTemplate's DataContext): 

<ig:DragSource IsDraggable="{Binding IsFileMarker}"/>

(IsFileMarker is a property of the View Model)

2. I want to use properties of my View Model (DataTemplate's DataContext) in the DragTemplate: 

<ig:DragSource.DragTemplate>

  <DataTemplate>

    <Border>

      <TextBlock Text="{Binding AnnotationItem.Name}" Margin="5" />

    </Border>

  </DataTemplate>

</ig:DragSource.DragTemplate>

(AnnotationItem is a property of the View Model)

None of these bindings work. Why ?

Regards,
Leif Opseth