Hopefully you have at least skimmed through NavFx Part 1 - Quick Reference and have a basic idea of what NavFx brings to your Silverlight applications. In this an subsequent articles I am going to walk you through how I use NavFx to build the next version of http://www.vrcyclist.com. I am not going to go into every gory detail, I will be focussing on the NavFx aspects of the application, but feel free to comment or ask questions about any aspect, I will do my best to answer them. Do bear in mind though I am not re-writing this application in Silverlight necessarily because it is best practice or the best way to do it. I am doing it because I can and I want to, although vrcyclist.com is an active community site, I provide it free to members on the basis that I can use it as a lab for improving and maintaining my skills and knowledge.
In this article I am going to walk through the process of setting up my Visual Studio 2008 solution using the C# NavFx templates (you can download these from the http://www.codeplex.com/NavFx). If you have downloaded these and created an application may have been dissappointed that you did not get the Sillverlight Application Wizard that handles wiring the project up to a web site and/or page. The templates were using the Export Template feature of VS 2008, which does not replicate the wizard so the wiring up has to be done manually, it is not a huge job but one that has to be done if you want to just hit F5 to run and debug your application. The following are the steps I took to get setup:
- Fire up VS 2008 and create a new Web Site (I called my solution VRC3 and my site Vrc3App)
- Next add the Silverlight Application that will provide the shell for my new VRC, right click on the solution in Solution Explorer and choose Add, New Project...
- In the Project Types tree expand Visual C# and select the Silverlight sub type
- Select the NavFxApplication template
- Set the name and location of the project (I called my project Vrc3Shell as you can see) and activate the OK button
- So no wizard to wire up the Silverlight project with the web site project. When VS 2008 Tool for Silverlight were installed the properties sheet for web projects was extended to include a new tab, this is where we do the wiring up manually
- Right click on the root of the web site project (Vrc3App in my solution) and choose Properties
- Activate the Silverlight Applications tab
- Click on the Add button to wire up the new NavFx project
- The options should be familiar to you if you have use the default Silverlight Application template before. The first part is as required, we want to wire up the existing application that was created from the NavFx template (you can use this dialog to add new Silverlight Application projects but you can't select a template to use)
- The default Destination folder is fine for us
- Select Copy to configuration specific folders this will ensure seperate Debug and Release versions are maintained within the site when you build and run the solution. In previous versions you only had one version based on the current Configuration selected for the project
- Adding a test page is optional (I left it on so I could copy and paste the generated code into my Default.aspx page)
- Enable Silverlight debugging is recommended
- Activate the Add button when you have all the settings as required
- The application is added to the Silverlight Applications tab
- A ClientBin folder is created in the web site project
- A test page is generated
That's it for setting up, I copied the code from my test page to Default.aspx and set this as my Startup Page and moved on to preparing my Shell.xaml to provide all of the navigation for my new Silverlight version of VRC. I walk you through the NavFx specifics of that step in my next article.
Previous Article Next Article