共用方式為


NavigationCommands.GoToPage 屬性

定義

取得代表 Go To Page 命令的值。

public:
 static property System::Windows::Input::RoutedUICommand ^ GoToPage { System::Windows::Input::RoutedUICommand ^ get(); };
public static System.Windows.Input.RoutedUICommand GoToPage { get; }
static member GoToPage : System.Windows.Input.RoutedUICommand
Public Shared ReadOnly Property GoToPage As RoutedUICommand

屬性值

路由UI命令。

預設值
按鍵動作 N/A
UI 文字 移至頁面

範例

下列範例示範如何搭配 FlowDocumentPageViewer使用 GoToPage 命令。 提供FlowDocumentPageViewer實作,可移至 控件的文字值TextBox所指定的頁面,以回應GoToPage命令。

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<!-- GoToPage UI-->
<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>
<!-- The following FlowDocumentPageViewer is used to process NavigationCommands.GoToPage commands -->
<FlowDocumentPageViewer Name="flowDocumentPageViewer">
  <FlowDocument>
    <!-- Document Content-->
    <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>
</Window>

備註

此命令指出變更縮放的目的。

DocumentViewerFlowDocumentPageViewer 實作回應 GoToPage 命令的支持,雖然您不需要使用它;在許多情況下,響應該命令的實作是應用程式寫入器的責任。

XAML Attribute Usage

<object property="NavigationCommands.GoToPage"/>  

適用於

另請參閱