mobile ads

Friday 11 October 2013

NavigationCommands Members 1

NavigationCommands.BrowseBack

Browseback property gets the value that represents the BrowseBack command

Key Gestures     -    ALT+LEFT
UI Text             -    Back

This command indicates the intention to navigate back to the previous page in the journal.
Frame and Navigation window implement support for responding to the BrowseBack, although you are not required to use it; in many cases the implementation in response to that command is the responsibility of the application writer.

Example
<MenuItem
  Command="NavigationCommands.BrowseBack"
  CommandTarget="{Binding ElementName=frame}" />
...

<Frame Name="frame" NavigationUIVisibility="Hidden" Source="Page1.xaml" />

NavigationCommands.BrowseForward 

BrowseForward property gets the value that represents the BrowseForward command

Key Gestures     -    ALT+RIGHT
UI Text             -    Forward

This command indicates the intention to navigate forward to the nextpage in the journal.
Frame and Navigation window implement support for responding to the BrowseForward, although you are not required to use it; in many cases the implementation in response to that command is the responsibility of the application writer.

Example
  <MenuItem Command="NavigationCommands.BrowseForward" CommandTarget="{Binding ElementName=frame}" />
 ...
 <Frame Name="frame" NavigationUIVisibility="Hidden" Source="Page1.xaml" />

NavigationCommands.BrowseHome


BrowseHome property gets the value that represents the BrowseHome command

Key Gestures     -    ALT+Home
UI Text             -    Home 

This command indicates the intention to navigate home.
There is no implementation for responding to the BrowseHome command on any given WPF class. As such, you need to provide an appropriate implementation, which is shown in the example.

XAML
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
 x:Class="SDKSample.BrowseHome"> 
..
   
<MenuItem Command="NavigationCommands.BrowseHome"> 
 <MenuItem.CommandBindings> 

<CommandBinding Command="NavigationCommands.BrowseHome" CanExecute="navigationCommandBrowseHome_CanExecute" Executed="navigationCommandBrowseHome_Executed" />  
</MenuItem.CommandBindings>  
</MenuItem> ... <Frame Name="frame" NavigationUIVisibility="Hidden" Source="Page1.xaml" /> 
... 
</Window> 

 C# 

using System.Windows; // Window  
 using System.Windows.Input; // CanExecuteRoutedEventArgs, ExecutedRoutedEventArgs  namespace SDKSample 

 public partial class BrowseHome : Window 

public BrowseHome()
 {
 InitializeComponent();
 }
 void navigationCommandBrowseHome_CanExecute(object sender, CanExecuteRoutedEventArgs e) 
{
 // Can always navigate home e.CanExecute = true;
 }
 void navigationCommandBrowseHome_Executed(object target, ExecutedRoutedEventArgs e) 
{
 // Implement custom BrowseHome handling code 
}
 }
 }

 NavigationCommands.BrowseStop


BrowseStop property gets the value that represents the BrowseStop command

Key Gestures     -    ALT+Esc
UI Text             -   Stop
This command indicates the intention to stop the browser loading.
Frame and NavigationWindow implement support for responding to the BrowseStop command, although you are not required to use it; in many cases the implementation in response to that command is the responsibility of the application writer.

Example
<MenuItem
  Command="NavigationCommands.BrowseStop"
  CommandTarget="{Binding ElementName=frame}" />
 
<Frame Name="frame" NavigationUIVisibility="Hidden" Source="Page1.xaml" />


NavigationCommands.DecreaseZoom


DecreaseZoom property gets the value that represents the DecreaseZoom command

Key Gestures     -   N/A
UI Text             -   Decrease Zoom
This command indicates the intention to decrease the zoom.
DocumentViewer, FlowDocumentReader, FlowDocumentScrollViewer, and FlowDocumentPageViewer implement support for responding to the DecreaseZoom command, although you are not required to use it; in many cases the implementation in response to that command is the responsibility of the application writer.

Example 


<MenuItem
  Command="NavigationCommands.DecreaseZoom"
  CommandTarget="{Binding ElementName=flowDocumentPageViewer}" />

...

<FlowDocumentPageViewer Name="flowDocumentPageViewer">
  <FlowDocument>
    
    <Paragraph>
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed vulputate,
 lacus non sagittis pharetra, diam dolor dictum tellus, et hendrerit odio risus
 nec erat. Nam sollicitudin imperdiet mi. Sed rutrum. Morbi vel nunc. Donec 
imperdiet. Morbi hendrerit leo. Maecenas imperdiet. Curabitur viverra tempor nisi.
 Phasellus vitae augue sit amet neque venenatis elementum. Proin posuere lobortis
 quam. Curabitur et neque. Donec ac sem vitae libero pharetra luctus. Fusce purus.
 Nulla vehicula, leo commodo dictum lobortis, odio augue accumsan ante, id dictum
 nisi libero quis diam. Nam augue erat, malesuada eu, tincidunt eu, dictum ut,
 ante. In vel magna vel ligula faucibus lobortis. Praesent a felis non mi
 fringilla vulputate. Integer quis tellus cursus elit tincidunt vehicula.
 Morbi commodo sem eu eros. Vestibulum ante ipsum primis in faucibus orci
 luctus et ultrices posuere cubilia Curae;
    </Paragraph>
...

  </FlowDocument>
</FlowDocumentPageViewer>


NavigationCommands.IncreaseZoom


IncreaseZoom property gets the value that represents the IncreaseZoom command

Key Gestures     -   N/A
UI Text             -   Increase Zoom
This command indicates the intention to increase the zoom.
DocumentViewer, FlowDocumentReader, FlowDocumentScrollViewer, and FlowDocumentPageViewer implement support for responding to the IncreaseZoom command, although you are not required to use it; in many cases the implementation in response to that command is the responsibility of the application writer.

Example 


<MenuItem
  Command="NavigationCommands.IncreaseZoom"
  CommandTarget="{Binding ElementName=flowDocumentPageViewer}" />

...

<FlowDocumentPageViewer Name="flowDocumentPageViewer">
  <FlowDocument>
    
    <Paragraph>
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed vulputate,
 lacus non sagittis pharetra, diam dolor dictum tellus, et hendrerit odio risus 
nec erat. Nam sollicitudin imperdiet mi. Sed rutrum. Morbi vel nunc. Donec 
imperdiet. Morbi hendrerit leo. Maecenas imperdiet. Curabitur viverra tempor 
nisi. Phasellus vitae augue sit amet neque venenatis elementum. Proin posuere
 lobortis quam. Curabitur et neque. Donec ac sem vitae libero pharetra luctus.
 Fusce purus. Nulla vehicula, leo commodo dictum lobortis, odio augue accumsan
 ante, id dictum nisi libero quis diam. Nam augue erat, malesuada eu, tincidunt 
eu, dictum ut, ante. In vel magna vel ligula faucibus lobortis. Praesent a felis
 non mi fringilla vulputate. Integer quis tellus cursus elit tincidunt vehicula.
 Morbi commodo sem eu eros. Vestibulum ante ipsum primis in faucibus orci luctus
 et ultrices posuere cubilia Curae;
    </Paragraph>
...

  </FlowDocument>
</FlowDocumentPageViewer>


NavigationCommands.GoToPage


GoToPage property gets the value that represents the Go To Page command

Key Gestures     -   N/A
UI Text             -   Go To Page

This command indicates the intention to change the zoom.
DocumentViewer and FlowDocumentPageViewer implement support for responding to the GoToPage command.
Example
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
  <TextBox Name="pageNumberTextBox">1</TextBox>
  <Button
    Command="NavigationCommands.GoToPage"
    CommandTarget="{Binding ElementName=flowDocumentPageViewer}"
    CommandParameter="{Binding ElementName=pageNumberTextBox,Path=Text}">Go To Page</Button>
</StackPanel>
...

<FlowDocumentPageViewer Name="flowDocumentPageViewer">
  <FlowDocument>
    
    <Paragraph>
      Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed vulputate,
 lacus non sagittis pharetra, diam dolor dictum tellus, et hendrerit odio risus
 nec erat. Nam sollicitudin imperdiet mi. Sed rutrum. Morbi vel nunc. Donec 
imperdiet. Morbi hendrerit leo. Maecenas imperdiet. Curabitur viverra tempor
 nisi. Phasellus vitae augue sit amet neque venenatis elementum. Proin posuere
 lobortis quam. Curabitur et neque. Donec ac sem vitae libero pharetra luctus.
 Fusce purus. Nulla vehicula, leo commodo dictum lobortis, odio augue accumsan
 ante, id dictum nisi libero quis diam. Nam augue erat, malesuada eu, tincidunt
 eu, dictum ut, ante. In vel magna vel ligula faucibus lobortis. Praesent a felis
 non mi fringilla vulputate. Integer quis tellus cursus elit tincidunt vehicula. 
Morbi commodo sem eu eros. Vestibulum ante ipsum primis in faucibus orci luctus e
t ultrices posuere cubilia Curae;
    </Paragraph>
...

  </FlowDocument>
</FlowDocumentPageViewer>

0 comments:

Post a Comment