Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
I don't know about you, but I get tired of seeing trivial little projects and product demos, so I decided to hunt down a mammoth project to show you. For this demo, I wanted big. Not only do I want big, I also want realistic. So I turned to Microsoft Open Source. Did you know that Microsoft maintains an open source web site called CodePlex? It's not as big as other open source sites, like SourceForge, but it has a lot of .NET projects available to download. I picked this Silverlight toolkit for today's demo.
This is production-level code that is maintained by Microsoft. To open a project in Visual Studio, you go to File > Open and then choose the Project/Solution menu item. Also, you can use Ctrl+Shift+O. For this project, I'm going to open the Exercise Files folder, Chapter 2, movie 3, and then here is the source for the Silverlight 4 toolkit.
I will drill down into Silverlight toolkit and then the Source folder, and then at the very bottom of the screen, I am looking at the Silverlight.Controls.toolkit.sln. You might remember from another movie that SLN is the file that loads the other projects. It just so happens that this project contains 23 projects and nearly 4,000 files. On my dual core laptop, it takes about five seconds to load the project and when I compile the code, it takes about 28 seconds to compile, the very first time I compiled the code.
Now you might remember that the Solution Explorer is there to let you navigate through your projects and your source code. So if I go over to my Solution Explorer, you will just see that I have a folder up here called Source. Now on your machine, you might need to collapse and open certain nodes in Solution Explorer. I have got a Source folder, I have got a Themes folder, and I have got a Testing folder. Inside the Source folder, I have multiple projects. There's a Controls.Data.toolkit project and many more.
The one I am interested in is down here. It's called Controls.toolkit. When I open that project, I see multiple folders. And here you can see, for instance, there is the DragDrop folder, the Expander folder, and inside the Expander folder is the actual code that creates the Expander control. And it appears that there are four files here: three C# files and one XAML file. Now if you are not familiar with XAML or X-A-M-L, that is the markup language that's used by Windows Font 7, Silverlight, and by WPF.
For today, I want to look at the GlobalCalendar. Now what does this look like when you run it? If I switch over to a browser--I have Internet Explorer open here-- I've loaded this site: silverlight.net and then this URL. This is a sample site for the tools I'm showing you currently. And if I open this up and scroll down to the Calendar section, this is the calendar control that we are looking at in Visual Studio. Again, this is production- level code we are looking at here. So switching back to Visual Studio, you will see that I have a class called GlobalCalendar, and I then want to go GlobalCalendar.xaml.
Down here, I have a GlobalCalendarButton.cs, which contains the source code for that button, and the GlobalCalendarButton .xaml file, which contains the XML markup. There are a lot of things that you can learn by looking at other people's code, both good and bad. I encourage you to explore this project and learn more about what Microsoft is doing with Silverlight.
Get unlimited access to all courses for just $25/month.Become a member