1 0 Archive | C# RSS feed for this section
post icon

Windows Phone 7 Navigation

03. Sep, 2010

This guide is accurate as of 12 August 2010, using Windows Phone 7 Beta SDK..

Seems like this will be the opening post for our Developers’ corner , Windows Phone 7 Navigation. Recently, I have been doing alot development on Windows Phone 7, for demostrations, for projects and many other stuffs and one of the most basic thing that people will ask when they start a development is how to navigate from “page” to “page”. ( In fact, a handful people had asked me already.) This tutorial shows us how to use the NavigationService.Navigate().

1. Create a Windows Phone 7 Silverlight project on Visual Studio. I named it as NavigationService
Creating a new project in Visual Studio 2010
Creating a new Windows Phone 7 Silverlight project with Visual Studio 2010

2. Create a new page by right clicking on your solution explorer and add a new item and choose Windows Phone Potrait page call Page2.xaml
Creating a new item in a Windows Phone 7 Project
Adding a new page

3. We need to set some stuffs in the second page and main page so we know it navigated. I made use of the properties window. If you cant find your properties window, you can do a Ctrl+W, P.
This are what i changed and added.

Edit the PageTitle in MainPage.xaml
—Text : Page 1

Edit the PageTitle in Page2.xaml
—Text : Page 2

Add a button in MainPage.xaml
—Name : btnGo
—Content : Go to Page 2

Changing properties

4. Lets add some code for Navigation in, double click on the button you created on MainPage.xaml, it should generate a click event handler for your button, btnGo. Add this in.

1
NavigationService.Navigate(new Uri("/Page2.xaml", UriKind.Relative));

5. F5 and see if your Page 1 changes to Page 2!! :D

Sample Code : Download sample code

Do visit out Developers’ corner for other guides!

Should there be any problem, please feel free to contact me at guohong ( at ) limguohong ( dot ) com

post icon

Windows 7 Workshop

22. Jan, 2010

Met YangLin, Pratibha, Eugene and Alex there while I attend the Windows 7 Development workshop at SMU organised by SG Acad Team, MS Singapore. I have been following Jocelyn Villaraza‘s blog but never had a chance to see her in action and today, finally, i had. Pretty good presentation done by her.

I am gonna rewrite one of her guide for my school’s bootcamp. Hope to get it done when I am free next week ( After Monday ). I never knew that program was so cool.

Going to teach wushu tomorrow morning!

post icon

One whole day

21. Jan, 2010

Yawnz, have been doing ECSA for one whole day… not one subject which I am most pleased with..

I want to do some bits of ENCM later at night! So excited about the Windows 7 development workshop tmr at SMU.

post icon

What I will be doing next?

02. Oct, 2008

Seems like its about 90% done.

I am looking to do a full HTML or CSS reference and tutorial website once I am done with my current website and promotion.

I have a few domains to use.

To do list:
-Upgrade my blog’s script
-C# boot camp #2 / #3 ( Its lying in my admin panel for very long already. )
-Disclaimer and About Me page.
-Clear up unused domains in my cPanel
-Clear up unused MySQL in my cPanel

post icon

= VS ==

28. Sep, 2008

Those who does coding should had once encountered this problem.

To use = or ==. I stumbled on this problem again yesterday when coding up the site.

= Used for assignment.
Example:
$variable = "guohong";
string variableString = "guohong";

== Used for comparison.
Example:
if ( $variable == "guohong" )

Just to put here to remind myself in the future

post icon

C# Boot Camp ( Part 1)

25. Sep, 2008

What is C#? ( Wiki to what is C# )

Anyway it was fun. 3 letters to summarise the whole UX ( User Experience ). Haha

This maybe useful for me in the future.
//This is how to comment in C#
//This is how to make a message box come out, Message.Show
//(CONTENT OF MESSAGE BOX, TITLE OF THE MESSAGE BOX)
Message.Show("Guo Hong", "Title")

In php, to add things on to a string variable, we do
$des = "Guo Hong is ";
$des .= "handome.";

but in C#,
string des = "Guo Hong is ";
des += "handome.";

Notice the += and .= ?

Haha, hopefully tomorrow will be more interesting! :D