Click here to Skip to main content
15,867,594 members
Articles / Mobile Apps / Windows Phone 7

Having Fun with Coding4Fun’s Windows Phone 7 Controls

Rate me:
Please Sign up or sign in to vote.
4.97/5 (10 votes)
11 Mar 2011CPOL3 min read 42.7K   602   24   8
A look at the new Windows Phone 7 controls by Coding4Fun

Introduction

image

I’m a big believer in having a hobby project as you can probably tell from the first sentence in my “personal webpage using Silverlight” article. One of my current hobby projects is to re-do my current WP7 application in the marketplace. I knew up front that I needed a “Loading” animation and a better “About” box. After starting to develop my own, I noticed a great set of WP7 controls by Coding4Fun and decided to use them in my new application. Before I go any further, they are FREE and Open-Source.

The full source code for the project can be downloaded from here.

Get the Bits

It is really simple to get started, just go to the CodePlex site and click the download button.

After you have downloaded it, extract it to a Folder and you will have 4 DLL files. They are listed below:

image

Now create a Windows Phone 7 Project and add references to the DLLs by right clicking on the References folder and clicking “Add references”.

image

ProgressOverlay Animation

After adding the references, we can get started. I needed a ProgressOverlay animation or “Loading Screen” while my RSS feed is downloading.

SNAGHTMLc1ceea1

Basically, you just need to add the following namespace to whatever page you want the control on:

XML
xmlns:Controls="clr-namespace:Coding4Fun.Phone.Controls;
	assembly=Coding4Fun.Phone.Controls" 
XML
<Controls:ProgressOverlay Name="progressOverlay" >
    <Controls:ProgressOverlay.Content>
        <TextBlock>Loading</TextBlock>
    </Controls:ProgressOverlay.Content>
</Controls:ProgressOverlay>		

Bam, you now have a great looking loading screen. Of course, inside the ProgressOverlay, you may want to add a Visibility property to turn it off after your data loads if you are using MVVM or similar pattern.

A Better "About Box"

Next up, I needed a nice clean “About Box” that looks good but is also functional. Meaning, if they click on my twitter name, web or email to launch the appropriate task.

SNAGHTMLcbf4bf0

Again, this is only a few lines of code:

C#
var p = new AboutPrompt();
p.VersionNumber = "2.0";
p.Show("Michael Crump", "@mbcrump", 
	"michael@michaelcrump.net", @"http://michaelcrump.net");

A nice clean “About” box with just a few lines of code! I’m all for code that I don’t have to write.

The InputBox

It also comes with a pretty sweet InputPrompt for grabbing info from a user:

SNAGHTMLcd1c370SNAGHTMLcd27216

The code for this is also very simple:

C#
InputPrompt input = new InputPrompt();
input.Completed += (s, e) =>
                       {
                           MessageBox.Show(e.Result.ToString());
                       };
 
input.Title = "Input Box";
input.Message = "What does a \"Developer Large\" T-Shirt Mean? ";
input.Show(); 

PhoneHelper Class

I also enjoyed the PhoneHelper that allows you to get data out of the WMAppManifest File very easily.

So for example, if I wanted the Version info from the WMAppManifest file.

image

I could write one line and get it.

C#
PhoneHelper.GetAppAttribute("Version") 

Of course, you would want to make sure you add the following using statement:

C#
using Coding4Fun.Phone.Controls.Data; 

You can’t have all these cool controls without a great set of Converters. The included BooleanToVisibility converter will convert a Boolean to and from a Visibility value. This is excellent when using something like a CheckBox to display a TextBox when it's checked. See the example below:

SNAGHTML11d9642cSNAGHTML11dbaef1

The code is below:

XML
<phone:PhoneApplicationPage.Resources>
    <Converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
</phone:PhoneApplicationPage.Resources>
<CheckBox x:Name="checkBox"/>
<TextBlock Text="Display Text" Visibility="{Binding ElementName=checkBox, 
	Path=IsChecked, Converter={StaticResource BooleanToVisibilityConverter} }"/> 

That’s not all the goodies included. They also provide a RoundedButton, TimePicker and several other converters. The documentation is great and I would recommend you give them a shot if you need any of this functionality. BTW, thank Brian Peek for his awesome work on Coding4Fun!

Like this article?

alt Subscribe to my feed

Image 12

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Telerik
United States United States
Michael Crump is a Silverlight MVP and MCPD that has been involved with computers in one way or another for as long as he can remember, but started professionally in 2002. After spending years working as a systems administrator/tech support analyst, Michael branched out and started developing internal utilities that automated repetitive tasks and freed up full-time employees. From there, he was offered a job working at McKesson corporation and has been working with some form of .NET and VB/C# since 2003.

He has worked at Fortune 500 companies where he gained experience in embedded systems design and software development to systems administration and database programming, and everything in between.

His primary focus right now is developing healthcare software solutions using Microsoft .NET technologies. He prefers building infrastructure components, reusable shared libraries and helping companies define, develop and automate process standards and guidelines.

You can read his blog at: MichaelCrump.net or follow him on Twitter at @mbcrump.

Comments and Discussions

 
GeneralMy vote of 5 Pin
Kanasz Robert21-Sep-12 1:41
professionalKanasz Robert21-Sep-12 1:41 
GeneralOne question related to AboutPrompt Pin
RredCat18-Feb-11 22:50
professionalRredCat18-Feb-11 22:50 
GeneralRe: One question related to AboutPrompt Pin
mbcrump19-Feb-11 6:18
mentormbcrump19-Feb-11 6:18 
GeneralRe: One question related to AboutPrompt Pin
RredCat19-Feb-11 6:20
professionalRredCat19-Feb-11 6:20 
GeneralMy vote of 5 Pin
Kunal Chowdhury «IN»18-Feb-11 15:04
professionalKunal Chowdhury «IN»18-Feb-11 15:04 
GeneralMy vote of 5 Pin
RaviRanjanKr18-Feb-11 2:43
professionalRaviRanjanKr18-Feb-11 2:43 
GeneralMy vote of 5 Pin
defwebserver18-Feb-11 2:05
defwebserver18-Feb-11 2:05 
GeneralRe: My vote of 5 Pin
mbcrump18-Feb-11 14:38
mentormbcrump18-Feb-11 14:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.