Magellan Introduction
Back to: Magellan Home
Magellan is a lightweight framework that makes it easy to build WPF navigation applications. It is inspired by the ASP.NET MVC framework. The main features are:
- Model-View-Controller support
- Action filters for cross-cutting concerns such as authorization and redirection
- Blend behaviors to make navigation easy
- Transitions between pages
Magellan was drawn from a number of samples I had put together early this year and some work done on a client project.
The source download includes an "iPhone" application for demonstrating the features.
We start with a simple project structure:
A controller implementation typically looks like this:
public class PhoneController : Controller
{
public ActionResult Group(Group group)
{
var contacts = _contactRepository.GetContacts(group);
Model = new GroupViewModel(group.Name, contacts);
return Page();
}
Views are XAML Page objects, and can optionally have a model. Here's an example:
The idea is that upon navigation, a controller is created, the action is executed, and the view and view model are created. The view then becomes the focus of the frame. Put simply, the view and viewmodel are stateful, and the controller is stateless.
Navigation between views (with nice transitions) can be done either programatically:
Navigator.For(Frame).NavigateWithTransition("Home", "Main", "ZoomOut");
Or through Blend behaviors:
The framework supports the ASP.NET MVC concepts of Action Filters, Model Binders, View Engines and more - I'll cover them in a later post.
Back to: Magellan Home