CSharpFeeds - All your C# feeds in one place.

Sponsors

Sunday, November 08, 2009

Magellan

by Paul Stovell via Paul Stovell on 11/8/2009 2:39:23 AM

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.

The sample iPhone application

We start with a simple project structure:

A VS2008 project with a number of folders for controllers, models and views

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 View();
    }

Views are XAML Page objects, and can optionally have a model. Here's an example:

View models

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:

Blend Navigate behavior

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.

email it!bookmark it!digg it!

Original Post: Magellan

Subscribe

New Feed

Product Spotlight

Recently Updated Sources

Legal Note

The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us