Intersoft ClientUI Documentation
NavigatedCommand Property
See Also  Send Feedback
Intersoft.Client.UI.Navigation Namespace > UXPage Class : NavigatedCommand Property






Gets or sets the command to execute when the UXFrame navigates to this page.

Syntax

Visual Basic (Declaration) 
<TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")>
<CategoryAttribute("Action")>
Public Property NavigatedCommand As ICommand
Visual Basic (Usage)Copy Code
Dim instance As UXPage
Dim value As ICommand
 
instance.NavigatedCommand = value
 
value = instance.NavigatedCommand
C# 
[TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")]
[CategoryAttribute("Action")]
public ICommand NavigatedCommand {get; set;}
Delphi 
public read-write property NavigatedCommand: ICommand; 
JScript 
TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")
CategoryAttribute("Action")
public function get,set NavigatedCommand : ICommand
Managed Extensions for C++ 
[TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")]
[CategoryAttribute("Action")]
public: __property ICommand* get_NavigatedCommand();
public: __property void set_NavigatedCommand( 
   ICommand* value
);
C++/CLI 
[TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")]
[CategoryAttribute("Action")]
public:
property ICommand^ NavigatedCommand {
   ICommand^ get();
   void set (    ICommand^ value);
}

Remarks

The page navigation framework fully supports MVVM design pattern through an efficient use of commanding. You handle the NavigatedCommand with a DelegateCommand in the ViewModel and write the custom navigation logic specific to the navigated page, for instances, to obtain contextual information of the navigation session such as query string and perform further data processing based on the query string parameters. For more information about commanding, see Commanding Overview.

The following example shows how to obtain the query string parameters of the navigated page, then assign the value to the property in the ViewModel for further interaction.

ViewModel Copy Code
    public class ContactsViewModel : ViewModelBase
    {
        private string _group;
        public ContactsViewModel()
        {
            this.NavigatedCommand = new DelegateCommand(OnNavigated);
        }
        public DelegateCommand NavigatedCommand { get; set; }
        public string Group
        {
            get { return _group; }
            set
            {
                if (_group != value)
                {
                    _group = value;
                    OnPropertyChanged("Group");
                    OnPropertyChanged("GroupTitle");
                }
            }
        }
        public string GroupTitle
        {
            get
            {
                if (string.IsNullOrEmpty(this.Group))
                    return "";
                else
                    return "Group: " + this.Group;
            }
        }
        private void OnNavigated(object parameter)
        {
            NavigatedCommandParameter navigatedParameter = parameter as NavigatedCommandParameter;
            if (navigatedParameter.QueryString != null && navigatedParameter.QueryString.Count > 0)
                this.Group = navigatedParameter.QueryString["id"];
        }
    }

XAML Copy Code
<Intersoft:UXPage 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:Intersoft="http://intersoft.clientui.com/schemas"
          xmlns:ViewModels="clr-namespace:SL_ClientUI_Outlook_Navigation.ViewModels"
    x:Class="SL_ClientUI_Outlook_Navigation.Views.Contacts" 
    Title="Contacts Page"
    d:DesignWidth="640" d:DesignHeight="480"
          NavigatedCommand="{Binding NavigatedCommand}">

    <Intersoft:UXPage.DataContext>
        <ViewModels:ContactsViewModel/>
    </Intersoft:UXPage.DataContext>
    
    <Grid x:Name="LayoutRoot">
        <Intersoft:DockPanel FillChildMode="Custom">
            <Grid Intersoft:DockPanel.Dock="Top">
                <StackPanel>
                    <TextBlock Text="{Binding GroupTitle}"/>
                </StackPanel>
            </Grid>
        </Intersoft:DockPanel>
    </Grid>
</Intersoft:UXPage>

The NavigatedCommand passes a NavigatedCommandParameter object to the parameter of the delegated command which contains a number properties that will be useful to obtain the contextual navigation information such as Uri, QueryString, and ParentDataContext.

The ParentDataContext is particularly useful to get the data context of the parent element that owns the page. This enables you to elegantly get the parent's ViewModel and obtain certain information for further processing.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2012 All Rights Reserved.