Recently, I’ve had to inform many of my contacts that I have a new phone number, so I thought to myself “Wow… this is a tough one, sending SMS to many people, using the regular SMS interface, adding contact one by one…”.
So I decided to develop a small Windows Phone app for doing that, and I would like to share my solution and show how I developed it step-by-step.
First, lets talk about the requirements of such an app:
- Sending SMS to contacts in my phone which are Mobile type only.
- Select relevant contacts from a list and filter the rest.
- Edit the message before sending it.
- Select relevant contacts from a list and send SMS only to them.
- Removing selected contacts after sending SMS.
Now that we have some requirements, lets create a simple Windows Phone project.
First thing to do is to create a new Windows Phone project, using Visual Studio:
You can download Windows Phone SDK 7.1 which include Visual Studio and Blend from APP HUB.
Now that we have an empty phone page, lets drop some user controls:
First lets change the application and page titles. From the solution explorer, open the MainPage.xaml by double clicking on it, then edit the following XAML:
Now lets drop the relevant controls into the page from the ToolBar on the left, and layout them using the designer.
For the contacts list we will use a simple ListBox, and for the SMS content we will use a simple TextBox.
After doing so, the XAML should be something similar to this:
Change the TextBox.AcceptsReturn property to “True” so it will display more them one line.
Ok, so now that we have basic controls, lets add Application Bar and two buttons so we can Filter contacts, and Send SMS.
First, unmark the Application Bar code in the bottom of the page, and re-mark the MenuItems section. We don’t need it.
Now, change the two buttons icons and text to something more relevant. To add your own images, create an Images folder in the project and add .png icons to it. You can use the images from the Windows Phone SDK: %ProgramFiles%\Microsoft SDKs\Windows Phone\v7.1\Icons\dark
Looking at the phone XAML designer, you should see something similar to this:
In the next post of this tutorial I’ll show how to connect the data behind and then how to design each item in the ListBox.