The web typically uses hyperlinks and postbacks to navigate between pages. With Magellan, we can use either a command, C# code, or using an Expression Blend Behavior.

When you reference the Magellan assemblies, the NavigateBehavior will appear in the Assets tab in Blend 3. You can drag and position it onto any UI element:



You can use the properties of the behavior to specify the values. The navigation behavior also allows parameters to be passed to the action, using the Parameters collection button.

In XAML, the behavior will appear as shown below:

<Button Content="Calculate">
    <i:Interaction.Behaviors>
        <NavigateBehavior Controller="Home" Action="Add">
            <NavigateBehavior.Parameters>
                <Parameter ParameterName="left" Value="{Binding Path=Left}" />
                <Parameter ParameterName="right" Value="{Binding Path=Right}" />
            </NavigateBehavior.Parameters>
        </NavigateBehavior>
    </i:Interaction.Behaviors>
</Button>

The parameters passed to the behavior should match the method arguments on the controller action - see the controller section for details. Note that the parameters support data binding - this allows you to pass properties from the model or other UI elements automatically.

Last edited Aug 22, 2010 at 2:29 PM by stovellp, version 3

Comments

No comments yet.