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. It is really simple to get started, just go to the CodePlex site and click the download button. After you have downloaded it then extract it to a Folder and you will have 4 DLL files. They are listed below: Now create a Windows Phone 7 Project and add references to the DLL’s by right clicking on the References folder and clicking “Add references”. After adding the references, we can get started. I needed a ProgressOverlay animation or “Loading Screen” while my RSS feed is downloading. Basically, you just need to add the following namespace to whatever page you want the control on: xmlns:Controls="clr-namespace:Coding4Fun.Phone.Controls;assembly=Coding4Fun.Phone.Controls"
And then the code inside your Grid or wherever you want the Loading screen placed.
<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.
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.
Again, this is only a few lines of code:
var
p = new AboutPrompt();
p.VersionNumber = "2.0";
p.Show("
Michael Crump", "@mbcrump", "
[email protected]", @"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.
It also comes with a pretty sweet InputPrompt for grabbing info from a user:
The code for this is also very simple:
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();
I also enjoyed the PhoneHelper that allows you to get data out of the WMAppManifest File very easy.
So for example if I wanted the Version info from the WMAppManifest file.
I could write one line and get it.
PhoneHelper.GetAppAttribute("Version")
Of course you would want to make sure you add the following using statement:
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 its checked. See the example below:
The code is below:
<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!
Subscribe to my feed