views:

302

answers:

1

Hi guys,

I am using MVVM Light toolkit for my WPF application and I would like to know if its possible, when using EventToCommand, to pass multiple parameters to RelayCommand and Is it possible to pass properties of EventArgs instead of passing the whole EventArgs ?

Regards, Nabeel

A: 

what if the scenario is

 <i:Interaction.Triggers>
                <i:EventTrigger EventName="KeyDown">
                    <cmd:EventToCommand Command="{Binding SearchKey}" PassEventArgsToCommand="True" 
                    CommandParameter="{Binding Text, ElementName=TextSearchCashDrawer}"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>

what is on enter key press i need to read the text from the textbox and perform search.

        SearchKey=new RelayCommand<KeyEventArgs>(e=>
                                                     {
                                                         if(e.PlatformKeyCode==13) //enter key
                                                         {


                                                         }
                                                     });

using this I can filter which key has been pressed but how to get that parameter if enter key is pressed in this mvvmlight.

webKite
you can bind the Textbox value to another property on your viewmodel and use that property in your relay command
nabeelfarid