AboutPrompt
Overview
Basically AboutPrompt is an UI component that derives from the toolkit`s abstract PopUp<T, TPopUpResult> class . As its name says it is a kind of extended popup which prompt for the OK button click .This control can display different content like Title, VersionName, WaterMark etc .
Getting Started
To begin using AboutPrompt first add a reference to the
Coding4Fun.Phone.Controls.dll assembly.
Creating AboutPrompt:
C#:
AboutPrompt about = new AboutPrompt();
about.Completed += about_Completed;
about.Show();
void about_Completed(object sender, PopUpEventArgs<object, PopUpResult> e)
{
//add some code here
}
Key Features
AboutPrompt exposes the following properties that can be used to customize its content:
- WaterMark,
- VersionNumber
- Title
- Body
- Footer
- HasGesturesDisabled
NOTE: What is the HasGesturesDisabled property? : With the current Gesture Service in the Silverlight Toolkit (November 2010 release), if two controls are overlapped and the bottom control has a listener attached, events will still bubble through with no way to cancel it without putting on a listener. In a control that is called PopUp, it is self defeating to have this bubble through effect happening. If the SL toolkit corrects the behavior, we’ll remove the HasGesturesDisabled property as it would no longer be needed. This would also remove the dependency on the Silverlight Toolkit.
When you want to show the AboutPrompt you can choose between 3 overloads of the Show() method:
- Show()
- Show(string authorName, string twitterName = null, string emailAddress = null, string websiteUrl = null)
- Show(params AboutPersonItem[] people) - This method accepts an array of AboutPersonItem items.
AboutPersonItem is a simple control that represents information about a single person and exposes the following properties of type string:
- WebSiteUrl
- Role
- EmailAddress
- AuthorName
When the AboutPrompt popup is closed the Completed event is fired.
Example1:
AboutPrompt about = new AboutPrompt();
about.Title = "Coding4fun";
about.Footer = @"http://coding4fun.codeplex.com/";
about.VersionNumber = "Version 1.5";
about.WaterMark = "AboutPropmt WaterMark string";
about.Body = new TextBlock { Text = "This is a demo of the Coding4fun AboutPrompt Body!", TextWrapping = TextWrapping.Wrap};
about.Completed += about_Completed;
about.Show();

Example2:
AboutPrompt p = new AboutPrompt();
p.Title = "AboutPersonItem test";
AboutPersonItem item = new AboutPersonItem();
item.AuthorName = "WindowsPhoneGeek";
item.EmailAddress = @"support@windowsphonegeek.com";
item.Role = "n/a";
item.WebSiteUrl = @"www.windowsphonegeek.com";
p.Show(item);

Example3:
AboutPrompt p = new AboutPrompt();
p.Show("Coding4fun", "@Coding4fun", "support@coding4fun.com", @"http://coding4fun.codeplex.com");

Example4:
Generally the AboutPrompt is designed to be used in code but sometimes users want to put some composite elements into the popup body so in this case it is easy to define these element is XAML. Here is one possible solution with UserControl. Just create a new UserControl named for example AboutPromptBody and add the following code into it:
AboutPromptBody UserControl:
<Border BorderBrush="YellowGreen" BorderThickness="2">
<StackPanel x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
<TextBlock Text="Body declared in UserControl XAML"/>
<Image Source="images/logo.png" Height="80" Width="80" HorizontalAlignment="Left"/>
<TextBlock Text="This is the first text in the Body section."/>
<Border Background="YellowGreen" Height="100" Width="400">
<TextBlock Text="Another Body content here" VerticalAlignment="Center"/>
</Border>
</StackPanel>
</Border>
MainPage.xaml.cs
AboutPrompt p = new AboutPrompt();
p.Title = "UserControl test";
p.Body = new AboutPromptBody();
p.Show();