I am studying to use MVVM pattern for my Silverlight application.
Following code is from xaml UI code :
<Button Width="30"
Margin="10"
Content="Find"
Command="{Binding Path=GetCustomersCommand, Source={StaticResource customerVM}}"
CommandParameter="{Binding Path=Text, ElementName=tbName}"/>
<TextBox x:Name="tbName"
Width="50" />
<TextBox x:Name="tbID"
Width="50" />
And following code is from ViewModel class :
public ICommand GetCustomersCommand
{
get { return new RelayCommand(GetCustomers) { IsEnabled = true }; }
}
public void GetCustomers(string name, string id)
{
// call server service (WCF service)
}
I need to pass two parameters, however, can't find out how to pass two parameters(id and name) to ViewModel class.
I'd like to know if it is possible in xaml code not in the codebehind.
Thanks in advance