Using a WCF service in a Windows Phone application
Now that we have a WCF service to work with, we need to build an application that can bind to it from the Windows Phone. To do this, add a project to this solution by right-clicking the solution root and selecting Add New | Project. We add this project as a Windows Phone application called WCFClient.
Getting ready
Now that we have our project created, we will want to add a reference to the service by right-clicking the references folder and selecting Add Service Reference:
This will bring up the service reference tool, and we will hit the discover button to find the service that is in our other project:
Once you have seen this screen, simply change the NameSpace to MyServiceReference and then click OK.
How to do it...
Now to build a ViewModel that can get data from this data service:
1. Add a new class file to our project called
MyViewModel.cs
. This will provide the code in the client side to call the server.2. Set up a reference to the service...