One of the newest (and arguably greatest) controls to be added to the RadControls for Silverlight suite recently has been RadScheduler. With it, you can take care of everything from scheduling your day to planning what track you want to attend at events. This versatile control allows you a lot of freedom to customize how you interact with it and just what you can do with appointments, which is what this series is going to be all about.
I won't spoil the future installments just yet (although they'll include using RadDragAndDrop in RadScheduler, albeit in a different way than this post from the Silverlight Team, advanced form editing, and customizing your scheduler, just to name a few), but this series will be your one-stop shop to go from 0 to 60 with RadScheduler so you can start using it in your applications today.
Our first topic that we will handle is the out-of-the-box experience and getting RadScheduler wired up using .Net RIA Services, which is currently (as of this article) in the July Preview. The first thing we do is to start a new Silverlight project and be sure to check the box to enable .Net RIA services. Once that project is created and before we move into the Silverlight project, we want to set up a database to handle our appointments. I'm taking a different approach than you see in this KB article or here from our support team, actually showing you an example of when Teodor mentions using a field with serialized exception appointments. Here is a look at my database:
Once I have this all set, I'm making an ADO.Net Entity Data Model and adding my SqlAppointments table to it. Rebuild, then the next step would be to add a new Domain Service Class to use for your RIA operations. One word of advice though, when you load this up it should look something like the following:
If not, close out and rebuild your app so that you get an entity that you can work with, but once you've got your SqlAppointments available, select it and make sure editing is enabled. Click okay and your .Web side is good to go.
In your Silverlight application, add your RadScheduler and set the Appointment Added, Edited, and Deleted events as well as giving it a name. Next, add a new DomainDataSource and set it to autoload, set the query name from your domain service class, and subscribe to the LoadedData event. Last but certainly not least, you'll want to set your DomainContext to the context you created in the .Web application. The end result will look like this:
Nifty, don't you think? :)
Next installment, we'll get to the events and how we handle everything. We'll also explore a neat little helper class I created called RecurrenceExceptionHelper (named in homage to the RecurrencePatternHelper that the awesome Scheduler team already gave us).
More to come!
Evan Hutnick works as a Developer Evangelist for Telerik specializing in Silverlight and WPF in addition to being a Microsoft MVP for Silverlight. After years as a development enthusiast in .Net technologies, he has been able to excel in XAML development helping to provide samples and expertise in these cutting edge technologies. You can find him on Twitter @EvanHutnick.
Subscribe to be the first to get our expert-written articles and tutorials for developers!
All fields are required