How to reference drageventArgs in xaml as command parameter using silverlight

on my silverlight 4 app I am trying to bind a drop event on a list box to my viewmodel. I am using an event blend 4 event trigger and invokecommandaction statement to wire the drop event. Setting breakpoints on my viewmodel, I can see that the corresponding function is triggered when I drag and drop a file into the list box, however, I cannot access the drageventArgs. I tried to send the whole list as a command parameter and it doesn't work.

Any ideas?

thanks

+2


a source to share


1 answer


I am looking at exactly this problem at the moment. After a little research, I found this http://www.silverlightshow.net/news/Silverlight-Commands-Hacks-Passing-EventArgs-as-CommandParameter-to-DelegateCommand-triggered-by-EventTrigger-.aspx

So in the meantime Ive decided to use the MVVM Lights EventToCommand class, which is similar to InvokeCommandAction but allows you to pass arguments in the arg argument as a command parameter. ( http://www.galasoft.ch/mvvm/getstarted/ )



- works fine

<i:Interaction.Triggers>
        <i:EventTrigger EventName="Drop">
            <infra:EventToCommand  PassEventArgsToCommand="True"
                                           Command="{Binding Path=LinkOrderCommand}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>

      

+1


a source







All Articles