Introduction
Hello, friends. After a very long time, here again comes my series of articles. This article decribes the new exciting Toolkit for Windows Phone 8 of the "Coding4 FunToolkit", that provides many more exciting controls to include in our Windows Phone app and make our app look more cool and more user friendly with less effort.
It provides Controls like:
- About Prompt
- Input Prompt
- Message Prompt
- Password Input Prompt
- Color Slider and Picker
- Round Button
- Round Toggle Button
- Progress Overlay
- Toast Prompt
- Memory Counter
- Color Hexagon Picker and many more.
This article explains a few of them and in our next article we will discuss the rest of them.
So here we go.
Step 1
Create a new Windows Phone project from your project template and provide it a name as you choose (like I have given "Coding4FunDemo1").
Now open the "Solution Explorer" window and right-click on your project. A list will be opened; click on the "Manage NuGet Packages.." option.
After clicking on the "Manage NuGet Packages.." option a new Nuget window will be poped up. Now search for "Coding4Fun Toolkit" in the search box and it will then show you the list of toolkits available for your search term "Coding4Fun Toolkit". Find the "Coding4Fun Toolkit-Complete" and click on the install button.
Now "Coding4Fun Toolkit" will be added to your project.
Step 2
Now it's time to add the reference for the toolkit.
In your XAML portion add the following namespace:
- xmlns:coding4fun="clr-namespace:Coding4Fun.Toolkit.Controls;assembly=Coding4Fun.Toolkit.Controls"
Step 3
Now add the "About Prompt" control in your project.
Adding the "About Prompt" control through XAML:
- <coding4fun:AboutPrompt x:Name="aboutPrompt" />
It has many properties like:
- Title
- Body
- Footer
- Water Mark
- Version Number and so on
However adding the "About Prompt" control through XAML is not usually prefered. It is suggested to add theses type of controls through the C# Code.
Step 4
Remove the XAML code that you have added for "About Prompt"; that is, remove the following line of code:
- <coding4fun:AboutPrompt x:Name="aboutPrompt" />
Now add a Button Control in your project so that when we click the button the "About Prompt" control will be shown.
Add the following line of code in your XAML file:
- <Button Content="About Prompt" x:Name="aboutPromptBtn" Click="aboutPromptBtn_Click" HorizontalAlignment="Left" Height="82" Margin="78,69,0,0" VerticalAlignment="Top" Width="314"/>
Your MainPage will look like this:
Navigate to your code that is in your "MainPage.xaml.cs" file add the following line of code:
- using Coding4Fun.Toolkit.Controls;
Navigate to your About Button Control Event Method stub and add the following line of code:
- private void aboutPromptBtn_Click(object sender, RoutedEventArgs e)
- {
-
- AboutPrompt prompt = new AboutPrompt();
-
-
- prompt.Title = "Coding4Fun Toolkit";
-
-
-
- prompt.Body = new TextBlock {Text="Hello
- Welcome to C-sharp Corner",
- TextWrapping=TextWrapping.Wrap };
-
- prompt.Footer = "Coding4Fun Toolkit Article";
-
- prompt.VersionNumber="v 1.0";
-
-
-
-
-
- prompt.Completed += prompt_Completed;
-
- prompt.Show();
-
- }
In the Completed Event Method stub add the following line of code:
- void prompt_Completed(object sender,
- PopUpEventArgs<object, PopUpResult> e)
- {
-
-
-
- MessageBox.Show("About Prompt Demonstrated");
- }
That's it. Compile and run your application. When you will click on the About Prompt Button Control a window will popup like this:
Now when the user presses the Check Button, or you can say the Ok Button, then the line of code that we added will be executed. Here we have added a Message Box. So after pressing the Check/OK Button the MessageBox will be shown.
You can however add whatever you want to execute in the Completed event.
So that's it for this article now. We will cover more Coding4Fun Toolkit in our future article.
Thank You .
If you have any query, feel free to ask.
I am embedding the Source Code here so that you can go through it.