Skip to main content

Posts

Showing posts with the label EventArgs

Handling UI control's events in ViewModel [Prism 5.0]

Recently I came across a requirement in which I was supposed to data bind a command from my viewModel to an event. In other words, my code-behind was not supposed to contain any code related to event handlers of a control. After digging more into Prism, luckily I found my answer. Above requirement can be achieved using InvokeCommandAction provided in Prism 5.0. Well, so my article will elaborate more on how to achieve this. InvokeCommandAction InvokeCommandAction consents us to invoke ICommand implementation on our viewModel to an event that exist on our control. It basically means, we are no longer bound or required to have a command property on a control in order to invoke a command. Now, you may say you have seen this similar thing before. And you are right because Blend SDK ships one. But the InvokeCommandAction which Prism provides is little bit different in two ways: First, it manages the state of the element. It updates the enable state of the control that is att