Currently my page works perfectly.
It has a button and a textbox as below:
<Button Command="{Binding [someViewModel].SomeCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Self}}" />
<TextBox Text="{Binding [someViewModel].userInput}"
And below I have the following definition for SomeCommand
:
public ICommand SomeCommand {get;set;}
SomeCommand = RelayCommand<FrameworkElement>
.GetInterceptableInstance((Action<FrameworkElement>)this.someMethod)
And below the definition for someMethod
:
private void someMethod(FrameworkElement control)
{
MessageBox.Show(this.userInput);
}
Basically, now when user click on the button, there will be a messagebox popping out and displaying the userInput. There are no problem and works perfectly.
Now I'm trying to invoke someMethod
when user key in ENTER at TextBox
but I've no idea what parameter I should provide to someMethod
.
Below is my implementation of detecting enter key:
private void DetectEnterKey(KeyEventArgs e)
{
if(e.Key==Key.Return)
{
//this.someMethod() with what parameter?
}
}