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
45
Using MVVM Commands with D&D
posted

I would like to preserve the MVVM pattern using the D&D framework on WPF 14.1. I am trying the InvokeCommandAction from System.Windows.Interactivity as seen:

 <DataTemplate x:Key="ListBoxItemTemplate" DataType="{x:Type infragisticsDragDrop:Person}">
                <StackPanel Background="DarkGray">
                    <ig:DragDropManager.DragSource>
                        <ig:DragSource IsDraggable="True">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="DragStart">
                                    <i:InvokeCommandAction Command="{Binding DragStartedCommand}" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </ig:DragSource>
                    </ig:DragDropManager.DragSource>
 
                    <TextBlock Margin="2"
                               Foreground="Red"
                               Text="{Binding Name}" />
                    <TextBlock Margin="2"
                               Foreground="Violet"
                               Text="{Binding Age}" />
 
                </StackPanel>
 
            </DataTemplate>

then using the template as:

  <ListBox Name="Lb1"
                 Grid.Column="0"
                 ItemTemplate="{StaticResource ListBoxItemTemplate}"
                 ItemsSource="{Binding People}" />

The command is never fired. I saw a similar post http://es.infragistics.com/community/forums/t/58203.aspx but could not get that to work either.

Any thoughts on what I am missing to get this to work as I intended?

InfragisticsDragDrop.zip
Parents Reply Children
No Data