Using Commands

Windows Phone XAML apps support the ICommand interface for buttons and various other controls. Commands are useful because when exposed from a viewmodel they allow your view to bind to them just like other properties; when the user interacts with the visual element, the command is executed. This enables you to move your UI logic from event handlers to higher level classes.

The ICommand interface defines the following three members:

Image CanExecute(object)A method called by the commanding infrastructure, which automatically sets the enabled state of the target control

Execute(object)A method that performs the logic of the command ...

Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.