0
votes

I am using Devexpress's SpinEdit control on a view. There is an event on it called 'EditValueChanging'. I need to remove this event from the view's code-behind and use RelayCommand in viewmodel instead. However I don't find any Command propery in the control with which to bind the RelayCommand. Also I can't implement a dependency property in my viewmodel as I have already inherited it with Mvvmlight Toolkit's ViewModelBase (hence GetValue and SetValue are not available). What is the possible way to remove the logic present in EditValueChanging event in my view's code-behind and put it in my viewmodel?

3

3 Answers

2
votes

Since you're already using MVVMLight, have you looked at its EventToCommand behavior?

Article from the author

Link to source for the class

1
votes

You could try the code found in this link. It allows you to bind a VM's RelayCommand to any event, not just a button's command event. I use it all the time.

1
votes

if you use MVVM Light anyway, just use the EventToCommand behavior. you can bind any event to an Command.