Click here to Skip to main content
15,896,063 members
Articles / Desktop Programming / WPF

WPF: A Beginner's Guide - Part 6 of n

Rate me:
Please Sign up or sign in to vote.
4.95/5 (93 votes)
5 Apr 2008CPOL23 min read 331.7K   5.2K   263  
An introduction into WPF Styles and Templates.
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;

namespace PlanetsListBox
{
	public class SolarSystem
	{
		private ObservableCollection<SolarSystemObject> solarSystemObjects;

		public ObservableCollection<SolarSystemObject> SolarSystemObjects
		{
			get { return solarSystemObjects; }
		}


		public SolarSystem()
		{
			this.solarSystemObjects = new ObservableCollection<SolarSystemObject>();
			this.solarSystemObjects.Add(new SolarSystemObject("Sun", 0, 1380000, new Uri(@"../Images/sun.jpg", UriKind.Relative), "The yellow dwarf star in the center of our solar system."));
            this.solarSystemObjects.Add(new SolarSystemObject("Mercury", 0.38, 4880, new Uri(@"../Images/merglobe.gif", UriKind.Relative), "The small and rocky planet Mercury is the closest planet to the Sun."));
            this.solarSystemObjects.Add(new SolarSystemObject("Venus", 0.72, 12103.6, new Uri(@"I../Images/venglobe.gif", UriKind.Relative), "At first glance, if Earth had a twin, it would be Venus."));
            this.solarSystemObjects.Add(new SolarSystemObject("Earth", 1, 12756.3, new Uri(@"../Images/earglobe.gif", UriKind.Relative), "Earth, our home planet, is the only planet in our solar system known to harbor life."));
            this.solarSystemObjects.Add(new SolarSystemObject("Mars", 1.52, 6794, new Uri(@"../Images/marglobe.gif", UriKind.Relative), "The red planet Mars has inspired wild flights of imagination over the centuries."));
            this.solarSystemObjects.Add(new SolarSystemObject("Jupiter", 5.20, 142984, new Uri(@"../Images/jupglobe.gif", UriKind.Relative), "With its numerous moons and several rings, the Jupiter system is a \"mini-solar system.\""));
            this.solarSystemObjects.Add(new SolarSystemObject("Saturn", 9.54, 120536, new Uri(@"../Images/2moons_2.gif", UriKind.Relative), "Saturn is the most distant of the five planets known to ancient stargazers."));
            this.solarSystemObjects.Add(new SolarSystemObject("Uranus", 19.218, 51118, new Uri(@"../Images/uraglobe.gif", UriKind.Relative), "Uranus gets its blue-green color from methane gas above the deeper cloud layers."));
            this.solarSystemObjects.Add(new SolarSystemObject("Neptune", 30.06, 49532, new Uri(@"../Images/nepglobe.gif", UriKind.Relative), "Neptune was the first planet located through mathematical predictions."));
            this.solarSystemObjects.Add(new SolarSystemObject("Pluto", 39.5, 2274, new Uri(@"../Images/plutoch_2.gif", UriKind.Relative), "Long considered to be the smallest, coldest, and most distant planet from the Sun."));
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
I currently hold the following qualifications (amongst others, I also studied Music Technology and Electronics, for my sins)

- MSc (Passed with distinctions), in Information Technology for E-Commerce
- BSc Hons (1st class) in Computer Science & Artificial Intelligence

Both of these at Sussex University UK.

Award(s)

I am lucky enough to have won a few awards for Zany Crazy code articles over the years

  • Microsoft C# MVP 2016
  • Codeproject MVP 2016
  • Microsoft C# MVP 2015
  • Codeproject MVP 2015
  • Microsoft C# MVP 2014
  • Codeproject MVP 2014
  • Microsoft C# MVP 2013
  • Codeproject MVP 2013
  • Microsoft C# MVP 2012
  • Codeproject MVP 2012
  • Microsoft C# MVP 2011
  • Codeproject MVP 2011
  • Microsoft C# MVP 2010
  • Codeproject MVP 2010
  • Microsoft C# MVP 2009
  • Codeproject MVP 2009
  • Microsoft C# MVP 2008
  • Codeproject MVP 2008
  • And numerous codeproject awards which you can see over at my blog

Comments and Discussions