<Page x:Class="mupdf_cpp.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:winapp" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> <Page.BottomAppBar> <AppBar> <Grid Margin="38,0,0,0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <Slider x:Name="xaml_PageSlider" Minimum="0" Maximum="10" PointerCaptureLost="Slider_ValueChanged" KeyUp="Slider_Key" Grid.Column="0" Margin="10,0" VerticalAlignment="Center" /> <Button x:Name="Find_File" Style="{StaticResource OpenFileAppBarButtonStyle}" Tag="OpenFile" HorizontalAlignment="Right" Grid.Column="1" Click="Picker"/> </Grid> </AppBar> </Page.BottomAppBar> <Page.TopAppBar> <AppBar x:Name="TopAppBar1" AutomationProperties.Name="Top App Bar" Loaded="topAppBar_Loaded"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <StackPanel x:Name="LeftPanel" Orientation="Horizontal" HorizontalAlignment="Left" > <TextBox x:Name="FindBox" Width="200" Height="20" Margin="2"/> <Button x:Name="PrevSearch" Style="{StaticResource PreviousAppBarButtonStyle}" Click="SearchPrev"/> <Button x:Name="NextSearch" Style="{StaticResource NextAppBarButtonStyle}" Click="SearchNext"/> </StackPanel> <StackPanel x:Name="RightPanel" Orientation="Horizontal" HorizontalAlignment="Right"> <Button x:Name="Search" Style="{StaticResource SearchAppBarButtonStyle}" Tag="Search" Click="Searcher"/> <Button x:Name="ZoomIn" Style="{StaticResource ZoomInAppBarButtonStyle}" Tag="ZoomIn" Click="ZoomInPress"/> <Button x:Name="ZoomOut" Style="{StaticResource ZoomOutAppBarButtonStyle}" Tag="ZoomOut" Click="ZoomOutPress"/> <Button x:Name="Contents" Style="{StaticResource ContentsBarButtonStyle}" Tag="Contents" Click="ContentDisplay"/> <Button x:Name="Links" Style="{StaticResource LinksAppBarButtonStyle}" Tag="Links" Click="Linker"/> <Button x:Name="Reflow" Style="{StaticResource ReflowAppBarButtonStyle}" Tag="Reflow" Click="Reflower"/> </StackPanel> </Grid> </AppBar> </Page.TopAppBar> <Grid x:Name="xaml_OutsideGrid"> <Grid.Background> <LinearGradientBrush EndPoint="-0.074,-0.068" StartPoint="1.027,1.024"> <GradientStop Color="Black"/> <GradientStop Color="White"/> <GradientStop Color="White" Offset="0.919"/> <GradientStop Color="#FFCDCDCD" Offset="0.741"/> <GradientStop Color="#FF909090" Offset="0.524"/> <GradientStop Color="#FF737373" Offset="0.421"/> <GradientStop Color="#FF2A2A2A" Offset="0.155"/> <GradientStop Color="#FF1A1A1A" Offset="0.097"/> <GradientStop Color="#FF040404" Offset="0.018"/> <GradientStop Color="#FFB3B3B3" Offset="0.651"/> <GradientStop Color="#FF989898" Offset="0.556"/> <GradientStop Color="#FF666666" Offset="0.375"/> <GradientStop Color="#FF4B4B4B" Offset="0.278"/> <GradientStop Color="#FF3A3A3A" Offset="0.215"/> </LinearGradientBrush> </Grid.Background> <Grid x:Name="xaml_MainGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SizeChanged="GridSizeChanged"> <Canvas x:Name="xaml_zoomCanvas" HorizontalAlignment="Center" VerticalAlignment="Center" ManipulationMode="All" > <!-- Horizontal flip view --> <FlipView x:Name="xaml_horiz_flipView" SelectionChanged="FlipView_SelectionChanged" VerticalAlignment="Center" HorizontalAlignment="Center" UseTouchAnimationsForAllNavigation="False"> <FlipView.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel Orientation="Horizontal"/> </ItemsPanelTemplate> </FlipView.ItemsPanel> <FlipView.ItemTemplate> <DataTemplate> <ScrollViewer Name="xaml_ScrollView_h" ZoomMode="Enabled" ViewChanged="ScrollChanged" HorizontalScrollMode="Auto" VerticalScrollMode="Auto" VerticalSnapPointsType="None" HorizontalSnapPointsType="None" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" MinZoomFactor="0.25" MaxZoomFactor="4" IsZoomChainingEnabled="true"> <Canvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="{Binding Height}" Width="{Binding Width}"> <Image Source="{Binding Image}" Width="{Binding Width}" Height="{Binding Height}" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0"/> <!-- After much work, figured out how to have a binding for the rectangles. TextBox and LinkBox are a collection that is in the other main collection used for the scroll viewer. It works nicely and cleanly once you figure out how to set up all the templates and the bindings --> <ItemsControl ItemsSource="{Binding Path=TextBox}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemContainerStyle> <Style TargetType="ContentPresenter"> <Setter Property="Canvas.Left" Value="{Binding Left}"/> <Setter Property="Canvas.Top" Value="{Binding Top}"/> </Style> </ItemsControl.ItemContainerStyle> <ItemsControl.ItemTemplate> <DataTemplate> <Rectangle Tag="{Binding Path=Index}" Width="{Binding Path=Width}" Height="{Binding Path=Height}" Fill="{Binding Path=Color}"> <Rectangle.RenderTransform> <TranslateTransform X="{Binding Path=X}" Y="{Binding Path=Y}"/> </Rectangle.RenderTransform> </Rectangle> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> <ItemsControl ItemsSource="{Binding Path=LinkBox}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemContainerStyle> <Style TargetType="ContentPresenter"> <Setter Property="Canvas.Left" Value="{Binding Left}"/> <Setter Property="Canvas.Top" Value="{Binding Top}"/> </Style> </ItemsControl.ItemContainerStyle> <ItemsControl.ItemTemplate> <DataTemplate> <Rectangle Tag="{Binding Path=Index}" Width="{Binding Path=Width}" Height="{Binding Path=Height}" Fill="{Binding Path=Color}" IsTapEnabled="True" Tapped="LinkTapped"> <Rectangle.RenderTransform> <TranslateTransform X="{Binding Path=X}" Y="{Binding Path=Y}"/> </Rectangle.RenderTransform> </Rectangle> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </Canvas> </ScrollViewer> </DataTemplate> </FlipView.ItemTemplate> </FlipView> <!-- Vertical flip view --> <FlipView x:Name="xaml_vert_flipView" SelectionChanged="FlipView_SelectionChanged" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False" Opacity="0" UseTouchAnimationsForAllNavigation="False"> <FlipView.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel Orientation="Vertical"/> </ItemsPanelTemplate> </FlipView.ItemsPanel> <FlipView.ItemTemplate> <DataTemplate> <ScrollViewer Name="xaml_ScrollView_v" ZoomMode="Enabled" ViewChanged="ScrollChanged" HorizontalScrollMode="Auto" VerticalScrollMode="Auto" VerticalSnapPointsType="None" HorizontalSnapPointsType="None" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" MinZoomFactor="0.25" MaxZoomFactor="4"> <Canvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="{Binding Height}" Width="{Binding Width}"> <Image Source="{Binding Image}" Width="{Binding Width}" Height="{Binding Height}" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0"/> <ItemsControl ItemsSource="{Binding Path=TextBox}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemContainerStyle> <Style TargetType="ContentPresenter"> <Setter Property="Canvas.Left" Value="{Binding Left}"/> <Setter Property="Canvas.Top" Value="{Binding Top}"/> </Style> </ItemsControl.ItemContainerStyle> <ItemsControl.ItemTemplate> <DataTemplate> <Rectangle Tag="{Binding Path=Index}" Width="{Binding Path=Width}" Height="{Binding Path=Height}" Fill="{Binding Path=Color}" IsTapEnabled="True" Tapped="LinkTapped"> <Rectangle.RenderTransform> <TranslateTransform X="{Binding Path=X}" Y="{Binding Path=Y}"/> </Rectangle.RenderTransform> </Rectangle> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> <ItemsControl ItemsSource="{Binding Path=LinkBox}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemContainerStyle> <Style TargetType="ContentPresenter"> <Setter Property="Canvas.Left" Value="{Binding Left}"/> <Setter Property="Canvas.Top" Value="{Binding Top}"/> </Style> </ItemsControl.ItemContainerStyle> <ItemsControl.ItemTemplate> <DataTemplate> <Rectangle Tag="{Binding Path=Index}" Width="{Binding Path=Width}" Height="{Binding Path=Height}" Fill="{Binding Path=Color}" IsTapEnabled="True" Tapped="LinkTapped"> <Rectangle.RenderTransform> <TranslateTransform X="{Binding Path=X}" Y="{Binding Path=Y}"/> </Rectangle.RenderTransform> </Rectangle> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </Canvas> </ScrollViewer> </DataTemplate> </FlipView.ItemTemplate> </FlipView> </Canvas> <ListView x:Name="xaml_ListView" Foreground="Black" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Opacity="0" IsItemClickEnabled="True" ItemClick="ContentSelected" SelectionMode="Single" IsEnabled="False"> <ListView.ItemTemplate> <DataTemplate> <StackPanel Margin="5,5,0,0" HorizontalAlignment="Left"> <TextBlock TextWrapping="Wrap" Text="{Binding StringMargin}" FontFamily="Segoe UI" FontSize="20" /> </StackPanel> </DataTemplate> </ListView.ItemTemplate> <ListView.Background> <SolidColorBrush Color="LightGray"></SolidColorBrush> </ListView.Background> </ListView> </Grid> <!-- Note that windows webview does not reflow when we scale. It will only do this with a size change. Unfortunately, the webview object is special in that it intercepts all actions and passes nothing to the application for these manipulations. I tried various things including the use of a webview brush to capture the current webview but that is a complex issue since it is a static image in that case. The other option would be to go to a Rich Text type of view. --> <WebView x:Name="xaml_WebView" HorizontalAlignment="Stretch" Width="Auto" Height="Auto" VerticalAlignment="Stretch" Visibility="Collapsed" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollMode="Enabled" ScrollViewer.HorizontalScrollMode="Enabled" ScrollViewer.ZoomMode="Enabled"/> <StackPanel x:Name="xaml_ProgressStack" Opacity="1" VerticalAlignment="Center" Margin="0,15" HorizontalAlignment="Center" Visibility="Collapsed"> <Border BorderThickness="5" BorderBrush="Black" > <StackPanel Background="LightGray" HorizontalAlignment="Left" Width="756" > <TextBlock HorizontalAlignment="Center" Margin="10" Text="Text Search Progress" FontSize="20"/> <ProgressBar x:Name="xaml_Progress" Margin="5" Height="15" IsIndeterminate="False" Maximum="100" VerticalAlignment="Stretch" /> <Button HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10" Click="CancelSearch" Height="39"> <TextBlock HorizontalAlignment="Center" Text="Cancel"/> </Button> </StackPanel> </Border> </StackPanel> <StackPanel x:Name="xaml_PrintStack" Opacity="1" VerticalAlignment="Center" Margin="0,15" HorizontalAlignment="Center" Visibility="Collapsed"> <Border BorderThickness="5" BorderBrush="Black" > <StackPanel Background="LightGray" HorizontalAlignment="Left" Width="756" > <TextBlock HorizontalAlignment="Center" Margin="10" Text="Print Progress" FontSize="20"/> <ProgressBar x:Name="xaml_PrintProgress" Margin="5" Height="15" IsIndeterminate="False" Maximum="100" VerticalAlignment="Stretch" /> <Button HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10" Click="HideProgress" Height="39"> <TextBlock HorizontalAlignment="Center" Text="Hide"/> </Button> </StackPanel> </Border> </StackPanel> <StackPanel x:Name="xaml_PasswordStack" Opacity="1" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Collapsed"> <Border BorderThickness="5" BorderBrush="Black" > <StackPanel Background="LightGray" > <TextBlock HorizontalAlignment="Center" Margin="10" Text="Password Required" FontSize="20"/> <PasswordBox x:Name="xaml_password" Height="35" Width="400" Margin="20"/> <Button HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10" Click="PasswordOK" Height="39"> <TextBlock HorizontalAlignment="Center" Text="OK"/> </Button> </StackPanel> </Border> </StackPanel> </Grid> </Page>