Binding commands in MVVM is a bit tricky, but if understood correctly then of a great use.
A simple command can be bound using a Delegate and the Icommand Interface to handle the function that is to be executed.
First of all we need to know what a Delegate is?
A Delegate is a reference to a function. A Delegate is much useful in an event execution. Although this example deals with a custom Delegate we can use a predefined delegates present in the System Namespace.
Secondly and most importantly, ICommand interface and its implementation. ICommand can be found in System.Windows.Input namespace. ICommand interface provides all the method signatures that are used to execute a command in MVVM. Continue reading →
Windows phone API allows us to access the phone book contact list using the code. Contacts are fetched in an observable list with details like Display Name, Company, Phone Number etc bundled in the Contacts object. These contacts can then be displayed in a list box with required details.
Following examples demonstrates the same.
We will use the Contacts class to fetch the details of phone book contacts.
To start with windows phone Contacts class first and foremost requirement is that of adding a capability of ID_CAP_CONTACTS in the WMAppManifest.xml file.
To add a capability either edit the XML or select the Capabilities tab from WMAppManifest.xml file and select the ID_CAP_CONTACTS check box located in the left part of the screen. Continue reading →