xaml-sdk/PdfViewer/PdfViewerCustomSaveCommand/MainWindow.xaml

146 строки
11 KiB
XML

<Window x:Class="PdfViewerCustomSaveCommand.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="600" Width="1000"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:converters="clr-namespace:Telerik.Windows.Documents.Converters;assembly=Telerik.Windows.Controls.FixedDocumentViewers"
x:Name="_this">
<Window.Resources>
<telerik:IconSources x:Key="IconPaths" LightBasePath="/Telerik.Windows.Controls.FixedDocumentViewers;component/Images/Modern/"
DarkBasePath="/Telerik.Windows.Controls.FixedDocumentViewers;component/Images/"
ModernBasePath="/Telerik.Windows.Controls.FixedDocumentViewers;component/Images/Modern/" />
<converters:FixedDocumentViewerModeConverter x:Key="ModeConverter" />
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<telerik:InvertedBooleanConverter x:Key="InvertedBooleanConverter"/>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<telerik:RadToolBar DataContext="{Binding ElementName=pdfViewer, Path=CommandDescriptors}">
<telerik:RadButton Padding="4" DataContext="{Binding ElementName=_this, Path=Commands}" Command="{Binding OpenCommand}">
<ToolTipService.ToolTip>
<TextBlock Text="Open" />
</ToolTipService.ToolTip>
<Image Source="{telerik:IconResource IconRelativePath=open.png, IconSources={StaticResource IconPaths}}" Stretch="None" />
</telerik:RadButton>
<telerik:RadButton Padding="4" DataContext="{Binding ElementName=_this, Path=Commands}" Command="{Binding SaveCommand}">
<ToolTipService.ToolTip>
<TextBlock Text="Save" />
</ToolTipService.ToolTip>
<Image Source="{telerik:IconResource IconRelativePath=save.png, IconSources={StaticResource IconPaths}}" Stretch="None" />
</telerik:RadButton>
<telerik:RadButton Command="{Binding PrintCommandDescriptor.Command}" Visibility="{Binding PrintCommandDescriptor.IsEnabled, Converter={StaticResource BoolToVisibilityConverter}}" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="2" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsBackgroundVisible="False">
<ToolTipService.ToolTip>
<TextBlock Text="Print" />
</ToolTipService.ToolTip>
<Image Source="{telerik:IconResource IconRelativePath=printer.png, IconSources={StaticResource IconPaths}}" Stretch="None" />
</telerik:RadButton>
<telerik:RadToolBarSeparator/>
<telerik:RadButton x:Name="counterClockwiseButton"
Command="{Binding RotateCounterClockwiseCommandDescriptor.Command}"
Margin="2" Padding="0" IsBackgroundVisible="False" HorizontalAlignment="Left" VerticalAlignment="Stretch">
<ToolTipService.ToolTip>
<TextBlock Text="Rotate counterclockwise" />
</ToolTipService.ToolTip>
<Image Source="pack://application:,,,/Telerik.Windows.Controls.FixedDocumentViewers;component/Images/Modern/rotate-counterclockwise.png" Stretch="None" />
</telerik:RadButton>
<telerik:RadButton x:Name="clockwiseButton"
Command="{Binding RotateClockwiseCommandDescriptor.Command}"
Margin="2" Padding="0" IsBackgroundVisible="False" HorizontalAlignment="Left" VerticalAlignment="Stretch">
<ToolTipService.ToolTip>
<TextBlock Text="Rotate clockwise" />
</ToolTipService.ToolTip>
<Image Source="pack://application:,,,/Telerik.Windows.Controls.FixedDocumentViewers;component/Images/Modern/rotate-clockwise.png" Stretch="None" />
</telerik:RadButton>
<telerik:RadToolBarSeparator/>
<telerik:RadButton Command="{Binding PageUpCommandDescriptor.Command}" Visibility="{Binding PageUpCommandDescriptor.IsEnabled, Converter={StaticResource BoolToVisibilityConverter}}" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="2" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsBackgroundVisible="False">
<ToolTipService.ToolTip>
<TextBlock Text="Previous page" />
</ToolTipService.ToolTip>
<Image Source="{telerik:IconResource IconRelativePath=previous.png, IconSources={StaticResource IconPaths}}" Stretch="None" />
</telerik:RadButton>
<telerik:RadButton Command="{Binding PageDownCommandDescriptor.Command}" Visibility="{Binding PageDownCommandDescriptor.IsEnabled, Converter={StaticResource BoolToVisibilityConverter}}" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="2" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsBackgroundVisible="False">
<ToolTipService.ToolTip>
<TextBlock Text="Next page" />
</ToolTipService.ToolTip>
<Image Source="{telerik:IconResource IconRelativePath=next.png, IconSources={StaticResource IconPaths}}" Stretch="None" />
</telerik:RadButton>
<TextBox Width="45" Margin="2" Text="{Binding FixedDocumentViewer.CurrentPageNumber, Mode=TwoWay}" HorizontalContentAlignment="Center" x:Name="tbCurrentPage" KeyDown="tbCurrentPage_KeyDown"/>
<TextBlock VerticalAlignment="Center" Margin="2" Text="/" />
<TextBlock VerticalAlignment="Center" Margin="2" Text="{Binding FixedDocumentViewer.PagesCount}" />
<telerik:RadToolBarSeparator/>
<telerik:RadButton Command="{Binding ZoomInCommandDescriptor.Command}" Visibility="{Binding ZoomInCommandDescriptor.IsEnabled, Converter={StaticResource BoolToVisibilityConverter}}" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="2" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsBackgroundVisible="False">
<ToolTipService.ToolTip>
<TextBlock Text="Zoom in" />
</ToolTipService.ToolTip>
<Image Source="{telerik:IconResource IconRelativePath=zoom-in.png, IconSources={StaticResource IconPaths}}" Stretch="None" />
</telerik:RadButton>
<telerik:RadButton x:Name="PART_btnZoomOut" Command="{Binding ZoomOutCommandDescriptor.Command}" Visibility="{Binding ZoomOutCommandDescriptor.IsEnabled, Converter={StaticResource BoolToVisibilityConverter}}" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="2" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsBackgroundVisible="False">
<ToolTipService.ToolTip>
<TextBlock Text="Zoom out" />
</ToolTipService.ToolTip>
<Image Source="{telerik:IconResource IconRelativePath=zoom-out.png, IconSources={StaticResource IconPaths}}" Stretch="None" />
</telerik:RadButton>
<telerik:RadToolBarSeparator />
<telerik:RadToggleButton x:Name="fitToWidthButton"
Command="{Binding FitToWidthFixedDocumentPagesPresenterCommandDescriptor.Command}"
IsEnabled="{Binding FitToWidthFixedDocumentPagesPresenterCommandDescriptor.IsEnabled, Converter={StaticResource InvertedBooleanConverter}, Mode=TwoWay}"
IsChecked="{Binding FitToWidthFixedDocumentPagesPresenterCommandDescriptor.IsEnabled, Mode=TwoWay}"
Margin="2" Padding="0" IsBackgroundVisible="False" HorizontalAlignment="Left" VerticalAlignment="Stretch">
<ToolTipService.ToolTip>
<TextBlock Text="Fit to window width and enable scrolling." />
</ToolTipService.ToolTip>
<Image Source="{telerik:IconResource IconRelativePath=document-fit-width.png, IconSources={StaticResource IconPaths}}" Stretch="None" />
</telerik:RadToggleButton>
<telerik:RadToggleButton x:Name="fitToPageButton"
Command="{Binding FitToPageFixedDocumentSinglePageViewPresenterCommandDescriptor.Command}"
IsEnabled="{Binding FitToPageFixedDocumentSinglePageViewPresenterCommandDescriptor.IsEnabled, Converter={StaticResource InvertedBooleanConverter}, Mode=TwoWay}"
IsChecked="{Binding FitToPageFixedDocumentSinglePageViewPresenterCommandDescriptor.IsEnabled, Mode=TwoWay}"
Margin="2" Padding="0" IsBackgroundVisible="False" HorizontalAlignment="Left" VerticalAlignment="Stretch">
<ToolTipService.ToolTip>
<TextBlock Text="Fit one full page to window." />
</ToolTipService.ToolTip>
<Image Source="{telerik:IconResource IconRelativePath=document-fit-page.png, IconSources={StaticResource IconPaths}}" Stretch="None" />
</telerik:RadToggleButton>
<telerik:RadToolBarSeparator />
<telerik:RadToggleButton IsChecked="{Binding FixedDocumentViewer.Mode, Mode=TwoWay, Converter={StaticResource ModeConverter}, ConverterParameter=Pan}" Margin="2" Padding="0" IsBackgroundVisible="False" HorizontalAlignment="Left" VerticalAlignment="Stretch">
<ToolTipService.ToolTip>
<TextBlock Text="Pan" />
</ToolTipService.ToolTip>
<Image Source="{telerik:IconResource IconRelativePath=hand-free.png, IconSources={StaticResource IconPaths}}" Stretch="None" />
</telerik:RadToggleButton>
<telerik:RadToggleButton IsChecked="{Binding FixedDocumentViewer.Mode, Mode=TwoWay, Converter={StaticResource ModeConverter}, ConverterParameter=TextSelection}" Margin="2" Padding="0" IsBackgroundVisible="False" HorizontalAlignment="Left" VerticalAlignment="Stretch">
<ToolTipService.ToolTip>
<TextBlock Text="Text Selection" />
</ToolTipService.ToolTip>
<Image Source="{telerik:IconResource IconRelativePath=text-selection.png, IconSources={StaticResource IconPaths}}" Stretch="None" />
</telerik:RadToggleButton>
</telerik:RadToolBar>
<telerik:RadPdfViewer Grid.Row="1" x:Name="pdfViewer" />
</Grid>
</Window>