NavigationCommands.Zoom 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得代表 Zoom
命令的值。
public:
static property System::Windows::Input::RoutedUICommand ^ Zoom { System::Windows::Input::RoutedUICommand ^ get(); };
public static System.Windows.Input.RoutedUICommand Zoom { get; }
static member Zoom : System.Windows.Input.RoutedUICommand
Public Shared ReadOnly Property Zoom As RoutedUICommand
屬性值
路由UI命令。
預設值 | |
---|---|
按鍵動作 | N/A |
UI 文字 | 縮放 |
範例
下列範例示範如何實作搭配 回應 Zoom 命令 FlowDocumentPageViewer的程序代碼。
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="SDKSample.Zoom">
<FlowDocumentPageViewer Name="flowDocumentPageViewer" MinZoom="50" MaxZoom="200">
<!-- Zoom Context Menu-->
<FlowDocumentPageViewer.ContextMenu>
<ContextMenu>
<ContextMenu.CommandBindings>
<CommandBinding
Command="NavigationCommands.Zoom"
CanExecute="navigationCommandZoom_CanExecute"
Executed="navigationCommandZoom_Executed" />
</ContextMenu.CommandBindings>
<MenuItem Header="50%" Command="NavigationCommands.Zoom" CommandParameter="50" />
<MenuItem Header="100%" Command="NavigationCommands.Zoom" CommandParameter="100" />
<MenuItem Header="150%" Command="NavigationCommands.Zoom" CommandParameter="150" />
<MenuItem Header="200%" Command="NavigationCommands.Zoom" CommandParameter="200" />
</ContextMenu>
</FlowDocumentPageViewer.ContextMenu>
<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>
備註
此命令指出設定縮放層級的意圖。
在任何指定的 WPF 類別上沒有回應 Zoom 命令的實作。 因此,您必須提供適當的實作,如範例所示。
XAML Attribute Usage
<object property="NavigationCommands.Zoom"/>