Intersoft ClientUI Documentation
NavigatedCommand Property



Gets or sets the command to execute when the UXFrame navigates to this page.
Syntax
<CategoryAttribute("Action")>
<TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")>
Public Property NavigatedCommand As ICommand
Dim instance As UXPage
Dim value As ICommand
 
instance.NavigatedCommand = value
 
value = instance.NavigatedCommand
[CategoryAttribute("Action")]
[TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")]
public ICommand NavigatedCommand {get; set;}
[CategoryAttribute("Action")]
[TypeConverterAttribute("Intersoft.Client.Framework.Input.CommandConverter, Intersoft.Client.Framework, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=c3d9b11444163e76")]
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 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

UXPage Class
UXPage Members

Send Feedback