liyijie 2 anos atrás
pai
commit
c4f1ef74ba

+ 1 - 0
PDF Office/CustomControl/WritableComboBox.xaml

@@ -18,6 +18,7 @@
             MinHeight="32"
             VerticalContentAlignment="Center"
             SelectionChanged="writableComboBox_SelectionChanged"
+            SelectedIndex="0"
             Visibility="Visible">
             <ComboBoxItem Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:WritableComboBox}, Path=IsAllPageVisible}">全部页面</ComboBoxItem>
             <ComboBoxItem>奇数页</ComboBoxItem>

+ 44 - 0
PDF Office/Helper/EditToolsHelper.cs

@@ -11,11 +11,22 @@ using PDF_Office.Model.EditTools.Background;
 using PDF_Office.Model.EditTools.Watermark;
 using ComPDFKit.PDFDocument;
 using System.Windows.Controls;
+using ComPDFKit.PDFPage;
+using static Dropbox.Api.TeamLog.PaperDownloadFormat;
+using Microsoft.Office.Interop.Word;
+using Task = System.Threading.Tasks.Task;
+using System.Drawing.Imaging;
 
 namespace PDF_Office.Helper
 {
     public static class EditToolsHelper
     {
+        private static byte[] BitmapData = null;
+
+        private static int Width=0;
+
+        private static int Height=0;
+
         public static byte[] ConvertColor(string color)
         {
             byte[] rgb_array = new byte[] { 0, 0, 0 };
@@ -75,6 +86,39 @@ namespace PDF_Office.Helper
             }
         }
 
+        public static void ChooseFile(string filePath, ref WatermarkInfo watermarkInfo, CPDFDocument document) {
+
+            GetBitmapFromDocment(filePath, document);
+            watermarkInfo.ImageArray = BitmapData;
+            watermarkInfo.ImageWidth = Width;
+            watermarkInfo.ImageHeight = Height;
+        }
+
+        public static void ChooseFile(string filePath, ref BackgroundInfo backgroundInfo, CPDFDocument document)
+        {
+
+            GetBitmapFromDocment(filePath, document);
+            backgroundInfo.ImageArray = BitmapData;
+            backgroundInfo.ImageWidth = Width;
+            backgroundInfo.ImageHeight = Height;
+        }
+
+        public static async void GetBitmapFromDocment(string filePath,CPDFDocument document)
+        {
+            CPDFPage page = document.PageAtIndex(0);
+            byte[] bmp_data = new byte[(int)page.PageSize.Width * (int)page.PageSize.Height * 4];
+            await Task.Run(delegate
+            {
+                page.RenderPageBitmap(0, 0, (int)page.PageSize.Width, (int)page.PageSize.Height, 0xffffffff, bmp_data, 1);
+            });
+            BitmapData = bmp_data;
+            Width = (int)page.PageSize.Width;
+            Height = (int)page.PageSize.Height;
+
+        }
+
+
+
         public static string ParseRange(string str)
         {
             try

+ 6 - 1
PDF Office/StyleAndTemplateList.txt

@@ -44,4 +44,9 @@
 位置:PDF Office\CustomControl\CommonWritableComboBox.xaml
 用途:设置带单位可输入的ComboBox
 提供可选项:绑定TypeSource设置可选项
-使用方法:设置Text设置初始值,绑定Value获得无单位的真值,Unit设置单位无单位为" "空格,其他单位为单个字符单位"%" 
+使用方法:设置Text设置初始值,绑定Value获得无单位的真值,Unit设置单位无单位为" "空格,其他单位为单个字符单位"%" 
+
+6.PageTurningPreview
+位置:PDF Office\CustomControl\PageTurningPreview.xaml
+用途:普通预览控件,可进行翻页
+使用方法:load自定义控件时设置PageIndexLists(负责控制页数),cpdfdocment(负责渲染的文件)

+ 12 - 2
PDF Office/ViewModels/EditTools/Watermark/WatermarkContentViewModel.cs

@@ -17,6 +17,10 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
         public IEventAggregator eventAggregator;
         public IRegionManager watermarkRegion;
 
+        private CPDFViewer PDFViewer;
+
+        private ViewContentViewModel viewContentViewModel;
+
         public string TemplateListName = "WatermarkTemplateListBaseContent";
         public string CreateName = "WatermarkCreateBaseContent";
         public string CreateModTextName = "WatermarkCreateTextContent";
@@ -123,18 +127,24 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
 
         public void EnterSelectedContent(string SelectedContentName)
         {
-            watermarkRegion.RequestNavigate(WatermarkSettingsRegionName, SelectedContentName);
+            NavigationParameters param = new NavigationParameters();
+            param.Add(ParameterNames.PDFViewer, PDFViewer);
+            watermarkRegion.RequestNavigate(WatermarkSettingsRegionName, SelectedContentName, param);
             WatermarkSettingsVisible = Visibility.Visible;
         }
 
         public void EnterDocumentContent()
         {
-            watermarkRegion.RequestNavigate(WatermarkDocumentRegionName, WatermarkDocumentName);
+            NavigationParameters param = new NavigationParameters();
+            param.Add(ParameterNames.PDFViewer, PDFViewer);
+            watermarkRegion.RequestNavigate(WatermarkDocumentRegionName, WatermarkDocumentName,param);
             WatermarkDocumentVisible = Visibility.Visible;
         }
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
+            navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             EnterSelectedContent(TemplateListName);
             EnterDocumentContent();
 

+ 8 - 2
PDF Office/ViewModels/EditTools/Watermark/WatermarkCreateBaseContentViewModel.cs

@@ -1,4 +1,6 @@
-using PDF_Office.EventAggregators;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.EventAggregators;
+using PDF_Office.Model;
 using Prism.Commands;
 using Prism.Events;
 using Prism.Mvvm;
@@ -15,6 +17,7 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
         IEventAggregator eventAggregator;
         IRegionManager watermarkCreateRegion;
 
+        private CPDFViewer PDFViewer;
 
         private string watermarkCreateRegionName;
 
@@ -65,7 +68,9 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
 
         public void EnterSelectedCreateMod(string currentCreateName)
         {
-            watermarkCreateRegion.RequestNavigate(WatermarkCreateRegionName, currentCreateName);
+            NavigationParameters param = new NavigationParameters();
+            param.Add(ParameterNames.PDFViewer, PDFViewer);
+            watermarkCreateRegion.RequestNavigate(WatermarkCreateRegionName, currentCreateName,param);
             watermarkCreateVisible = System.Windows.Visibility.Visible;
         }
 
@@ -92,6 +97,7 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
         }
     }
 }

+ 45 - 10
PDF Office/ViewModels/EditTools/Watermark/WatermarkCreateFileContentViewModel.cs

@@ -1,24 +1,31 @@
 using ComPDFKit.PDFWatermark;
 using ComPDFKitViewer.PdfViewer;
 using PDF_Office.CustomControl;
+using PDF_Office.EventAggregators;
 using PDF_Office.Helper;
+using PDF_Office.Model;
 using PDF_Office.Model.EditTools.Watermark;
 using PDF_Office.Model.PageEdit;
 using Prism.Commands;
+using Prism.Events;
 using Prism.Mvvm;
 using Prism.Regions;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.IO;
 using System.Linq;
+using System.Windows;
 
 namespace PDF_Office.ViewModels.EditTools.Watermark
 {
     public class WatermarkCreateFileContentViewModel : BindableBase, INavigationAware
     {
-        public WatermarkInfo WatermarkInfo  = new WatermarkInfo();
+        public WatermarkInfo WatermarkInfo = new WatermarkInfo();
 
-        public CPDFViewer currentViewer;
+        private CPDFViewer PDFViewer;
+
+        IEventAggregator eventAggregator;
 
         private List<string> _opacityList = new List<string>();
         public List<string> OpacityList
@@ -170,7 +177,7 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
             }
         }
 
-        public string PageRangeText{get;set;} = "0";
+        public string PageRangeText { get; set; } = "0";
 
         private int _pageRangeSelectIndex = 0;
         public int PageRangeSelectIndex
@@ -179,7 +186,7 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
             set
             {
                 SetProperty(ref _pageRangeSelectIndex, value);
-                EditToolsHelper.GetPageRange(PageRangeSelectIndex, currentViewer.Document,ref WatermarkInfo.PageRange, PageRangeText);
+                EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref WatermarkInfo.PageRange, PageRangeText);
             }
         }
 
@@ -204,6 +211,13 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
             }
         }
 
+        private Visibility _creatFileVisible = Visibility.Collapsed;
+        public Visibility CreatFileVisible
+        {
+            get { return _creatFileVisible; }
+            set { SetProperty(ref _creatFileVisible, value); }
+        }
+
         private ObservableDictionary<string, bool> _getLocationFromNumber = new ObservableDictionary<string, bool>();
         public ObservableDictionary<string, bool> GetLocationFromNumber
         {
@@ -216,15 +230,17 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
 
         public DelegateCommand OpenFileCommand { get; set; }
 
-        public WatermarkCreateFileContentViewModel()
+        public WatermarkCreateFileContentViewModel(IEventAggregator eventAggregator)
         {
-
+            this.eventAggregator = eventAggregator;
+            WatermarkInfo.WatermarkType=C_Watermark_Type.WATERMARK_TYPE_IMG;
             ChangeLocationCommand = new DelegateCommand<object>(ChangeLocation);
             OpenFileCommand = new DelegateCommand(OpenFile);
             InitList();
             WatermarkInfo.WatermarkHorizalign = C_Watermark_Horizalign.WATERMARK_HORIZALIGN_CENTER;
             WatermarkInfo.WatermarkVertalign = C_Watermark_Vertalign.WATERMARK_VERTALIGN_CENTER;
             InitLocationButtonMatrix();
+            eventAggregator.GetEvent<ConfirmEditToolsWatermarkEvent>().Subscribe(ConfirmEditToolsWatermark);
         }
 
         private void SetIsFront(int Index)
@@ -274,14 +290,32 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
             }
         }
 
-        public void OpenFile(){
+        public void ConfirmEditToolsWatermark(EnumTextOrFile enumTextOrFile)
+        {
+            if (enumTextOrFile == EnumTextOrFile.StatusFile)
+            {
+                eventAggregator.GetEvent<SetWatermarkEvent>().Publish(WatermarkInfo);
+            }
+        }
+
+        public void OpenFile()
+        {
             System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
             dlg.Multiselect = false;
-            dlg.Filter = "PDF|*.png;*.jpg;";
+            dlg.Filter = "PDF|*.png;*.jpg;*.pdf";
             if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
-                FileNameText = dlg.FileName;
-                EditToolsHelper.ChooseFile(dlg.FileName, ref WatermarkInfo);
+                FileNameText = dlg.SafeFileName;
+                FileInfo file = new FileInfo(dlg.FileName);
+                if (file.Extension == ".pdf")
+                {
+                    EditToolsHelper.ChooseFile(dlg.FileName, ref WatermarkInfo, PDFViewer.Document);
+                }
+                else
+                {
+                    EditToolsHelper.ChooseFile(dlg.FileName, ref WatermarkInfo);
+                }
+                CreatFileVisible=Visibility.Visible;
             }
         }
 
@@ -296,6 +330,7 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
         }
     }
 }

+ 21 - 7
PDF Office/ViewModels/EditTools/Watermark/WatermarkCreateTextContentViewModel.cs

@@ -3,6 +3,7 @@ using ComPDFKit.PDFWatermark;
 using ComPDFKitViewer.PdfViewer;
 using PDF_Office.EventAggregators;
 using PDF_Office.Helper;
+using PDF_Office.Model;
 using PDF_Office.Model.EditTools.Background;
 using PDF_Office.Model.EditTools.Watermark;
 using Prism.Commands;
@@ -21,7 +22,7 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
 
         IEventAggregator eventAggregator;
 
-        public CPDFViewer currentViewer;
+        private CPDFViewer PDFViewer;
 
         private List<string> _opacityList = new List<string>();
         public List<string> OpacityList
@@ -144,6 +145,17 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
             IsFrontList.Add("位于页面下方");
         }
 
+        private string _textValue = "一个水印";
+        public string TextValue
+        {
+            get { return _textValue; }
+            set
+            {
+                SetProperty(ref _textValue, value);
+                WatermarkInfo.Text = TextValue;
+            }
+        }
+
         private int _rotationValue = 0;
         public int RotationValue
         {
@@ -162,7 +174,7 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
             set
             {
                 SetProperty(ref _opacityValue, value);
-                WatermarkInfo.Opacity = (byte)((float)(OpacityValue/100)*225);
+                WatermarkInfo.Opacity = (byte)(((float)OpacityValue/100)*225);
             }
         }
 
@@ -276,7 +288,7 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
             set
             {
                 SetProperty(ref _pageRangeSelectIndex, value);
-                EditToolsHelper.GetPageRange(PageRangeSelectIndex, currentViewer.Document, ref WatermarkInfo.PageRange, PageRangeText);
+                EditToolsHelper.GetPageRange(PageRangeSelectIndex, PDFViewer.Document, ref WatermarkInfo.PageRange, PageRangeText);
             }
         }
 
@@ -292,6 +304,8 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
         public WatermarkCreateTextContentViewModel(IEventAggregator eventAggregator)
         {
             this.eventAggregator=eventAggregator;
+            WatermarkInfo.WatermarkType = C_Watermark_Type.WATERMARK_TYPE_TEXT;
+            StringColor = "#FFFF00";
             ChangeLocationCommand = new DelegateCommand<object>(ChangeLocation);
             InitList();
             WatermarkInfo.WatermarkHorizalign = C_Watermark_Horizalign.WATERMARK_HORIZALIGN_CENTER;
@@ -340,7 +354,7 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
             }
             else
             {
-                FontSizeList.Add((Index+7).ToString());
+                WatermarkInfo.TextSize =(Index+7).ToString();
             }
         }
 
@@ -348,10 +362,10 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
         {
             if (Index == 0) 
             { 
-            WatermarkInfo.IsFront=false;
+            WatermarkInfo.IsFront=true;
             }
             if (Index == 1) { 
-            WatermarkInfo.IsFront = true;
+            WatermarkInfo.IsFront = false;
             }
         }
 
@@ -383,7 +397,7 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
-            
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
         }
     }
 }

+ 98 - 1
PDF Office/ViewModels/EditTools/Watermark/WatermarkDocumentContentViewModel.cs

@@ -10,14 +10,37 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using PDF_Office.Model.EditTools.Watermark;
+using ComPDFKit.PDFDocument;
+using ComPDFKit.PDFPage;
+using System.Windows.Media.Imaging;
+using System.Windows.Media;
+using System.Threading.Tasks;
+using ComPDFKit.PDFWatermark;
+using PDF_Office.Helper;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter;
+using System.Drawing;
+using System.Windows;
 
 namespace PDF_Office.ViewModels.EditTools.Watermark
 {
-    public class WatermarkDocumentContentViewModel : BindableBase
+    public class WatermarkDocumentContentViewModel : BindableBase,INavigationAware
     {
 
         public IEventAggregator eventAggregator;
         public CPDFViewer PDFViewer;
+        public CPDFDocument document;
+        private CPDFWatermark watermark;
+
+        private ImageSource _imageSource = null;
+        public ImageSource ImageSource
+        {
+            get { return _imageSource; }
+            set
+            {
+                SetProperty(ref _imageSource, value);
+            }
+        }
+
         public WatermarkDocumentContentViewModel(IEventAggregator eventAggregator)
         {
             this.eventAggregator = eventAggregator;
@@ -26,7 +49,78 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
 
         public void SetWatermark(WatermarkInfo watermarkInfo)
         {
+            CreateWatermark(watermarkInfo);
+            document.PdfToImage("0-1", "C:\\Users\\kdanmobile\\Desktop");
+            document.WriteToFilePath("C:\\Users\\kdanmobile\\Desktop\\sb22222.pdf");
+            AwaitRenderBitmap(document);
+        }
 
+        public void CreateWatermark(WatermarkInfo watermarkInfo)
+        {
+            if (watermarkInfo.WatermarkType == C_Watermark_Type.WATERMARK_TYPE_TEXT)
+            {
+                watermark = document.InitWatermark(C_Watermark_Type.WATERMARK_TYPE_TEXT);
+                watermark.SetText(watermarkInfo.Text);
+                if (watermarkInfo.TextSize == null)
+                {
+                    watermarkInfo.TextSize = "6";
+                }
+                watermark.SetScale(float.Parse(watermarkInfo.TextSize));
+                watermark.SetTextRGBColor(watermarkInfo.TextColor);
+            }
+            else
+            {
+                watermark = document.InitWatermark(C_Watermark_Type.WATERMARK_TYPE_IMG);
+                watermark.SetImage(watermarkInfo.ImageArray, watermarkInfo.ImageWidth, watermarkInfo.ImageHeight);
+                watermark.SetScale(watermarkInfo.ImageSize % 100);
+            }
+            watermark.SetRotation(watermarkInfo.Rotation);
+            watermark.SetOpacity(watermarkInfo.Opacity);
+            watermark.SetFront(watermarkInfo.IsFront);
+            watermark.SetVertalign(watermarkInfo.WatermarkVertalign);
+            watermark.SetHorizalign(watermarkInfo.WatermarkHorizalign);
+            watermark.SetFullScreen(true);
+            watermark.SetVertOffset(watermarkInfo.VertOffset);
+            watermark.SetHorizOffset(watermarkInfo.HorizOffset);
+            watermark.SetHorizontalSpacing(watermarkInfo.HorizontalSpacing);
+            watermark.SetVerticalSpacing(watermarkInfo.VerticalSpacing);
+            watermark.SetPages("0");
+            watermark.CreateWatermark();
+            watermark.UpdateWatermark();
+            
+        }
+        public static BitmapSource ToBitmapSource(System.Drawing.Bitmap image)
+        {
+            IntPtr ptr = image.GetHbitmap();//obtain the Hbitmap
+            BitmapSource bs = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap
+            (
+                ptr,
+                IntPtr.Zero,
+                Int32Rect.Empty,
+                System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()
+            );
+            return bs;
+        }
+
+        public async Task RenderBitmap(CPDFDocument doc)
+        {
+            
+            CPDFPage page = doc.PageAtIndex(0,true);
+            
+            byte[] bmp_data = new byte[(int)page.PageSize.Width * (int)page.PageSize.Height * 4];
+            Bitmap bitmap = await ToolMethod.RenderPageBitmap(document, (int)(page.PageSize.Width * 1 * 1.4), (int)(page.PageSize.Height * 1 * 1.4), 0, true, true);
+            //await Task.Run(delegate
+            //{
+
+            //    page.RenderPageBitmap(0, 0, (int)page.PageSize.Width, (int)page.PageSize.Height, 0xffffffff, bmp_data, 1);
+            //});
+            //PixelFormat fmt = PixelFormats.Bgra32;
+            //BitmapSource bps = BitmapSource.Create((int)page.PageSize.Width, (int)page.PageSize.Height, 96.0, 96.0, fmt, null, bmp_data, ((int)page.PageSize.Width * fmt.BitsPerPixel + 7) / 8);
+            ImageSource = ToBitmapSource(bitmap);
+        }
+        public async void AwaitRenderBitmap(CPDFDocument doc)
+        {
+            await RenderBitmap(doc);
         }
 
         public bool IsNavigationTarget(NavigationContext navigationContext)
@@ -36,11 +130,14 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
 
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
+
         }
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            document = PDFViewer.Document;
+            AwaitRenderBitmap(PDFViewer.Document);
         }
     }
 }

+ 1 - 1
PDF Office/Views/EditTools/Watermark/WatermarkCreateFileContent.xaml

@@ -20,7 +20,7 @@
                 <Button Content="+" Width="32" Height="32" Margin="8,0,0,0" Command="{Binding OpenFileCommand}"></Button>
             </StackPanel>
         </Grid>
-        <Grid Grid.Row="1" Visibility="{Binding ElementName=FileNameTextBox,Path=Text}">
+        <Grid Grid.Row="1" Visibility="{Binding CreatFileVisible}">
             <Grid.RowDefinitions>
                 <RowDefinition Height="197"/>
                 <RowDefinition Height="200"/>

+ 1 - 1
PDF Office/Views/EditTools/Watermark/WatermarkCreateTextContent.xaml

@@ -18,7 +18,7 @@
         </Grid.RowDefinitions>
         <Grid Grid.Row="0" Width="228">
             <StackPanel Orientation="Vertical">
-                <TextBox Height="72" Margin="0,16,0,0" Text="一个水印" FontSize="14"></TextBox>
+                <TextBox Height="72" Margin="0,16,0,0" Text="{Binding TextValue,Mode=TwoWay}" FontSize="14"></TextBox>
                 <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
                     <ComboBox Width="154" Height="32" SelectedIndex="{Binding FontNameSelectedIndex}" ItemsSource="{Binding FontNameList}"></ComboBox>
                     <ComboBox Width="66" Height="32" Margin="8,0,0,0" ItemsSource="{Binding FontSizeList}" SelectedIndex="{Binding FontSizeSelectedIndex}"></ComboBox>

+ 36 - 31
PDF Office/Views/EditTools/Watermark/WatermarkDocumentContent.xaml

@@ -1,33 +1,38 @@
 <UserControl x:Class="PDF_Office.Views.EditTools.Watermark.WatermarkDocumentContent"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:prism="http://prismlibrary.com/"             
-             prism:ViewModelLocator.AutoWireViewModel="True"
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-              mc:Ignorable="d"
-             d:DesignHeight="720"
-             d:DesignWidth="1020" >
-    <Grid Height="720" Width="1020" Background="SkyBlue">
-        <Border  Height="64" Width="293" HorizontalAlignment="Center"  VerticalAlignment="Bottom"  Panel.ZIndex="1" Margin="9" Background="#323232" CornerRadius="4">
-            <Grid>
-                <StackPanel Orientation="Horizontal"  VerticalAlignment="Center">
-                    <StackPanel Orientation="Horizontal">
-                        <TextBlock Text="-" FontSize="20" Foreground="White" Margin="20,0,20,0"></TextBlock>
-                        <TextBlock Text="+" FontSize="20" Foreground="White" Margin="0,0,39,0"></TextBlock>
-                    </StackPanel>
-                    <StackPanel Orientation="Horizontal">
-                        <TextBlock Text="1" FontSize="20" Foreground="White" Margin="0,0,24,0"></TextBlock>
-                        <TextBlock Text="/" FontSize="20" Foreground="White" Margin="0,0,24,0"></TextBlock>
-                        <TextBlock Text="20" FontSize="20" Foreground="White" Margin="0,0,24,0"></TextBlock>
-                    </StackPanel>
-                    <StackPanel Orientation="Horizontal">
-                        <TextBlock Text="↑" FontSize="20" Foreground="White" Margin="20,0,20,0"></TextBlock>
-                        <TextBlock Text="↓" FontSize="20" Foreground="White"></TextBlock>
-
-                    </StackPanel>
-                </StackPanel>
-            </Grid>
-        </Border>
-    </Grid>
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:prism="http://prismlibrary.com/"             
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+              mc:Ignorable="d"
+             d:DesignHeight="720"
+             d:DesignWidth="1020" >
+    <Grid Height="720" Width="1020" Background="SkyBlue">
+        <Border  Margin="0,16,0,0" HorizontalAlignment="Center" VerticalAlignment="Top" Background="#FFFFFF"  Height="679" Width="514">
+            <Viewbox>
+                <Image Name="Image"  Source="{Binding ImageSource,Mode=TwoWay}"></Image>
+            </Viewbox>
+        </Border>
+        <Border  Height="64" Width="293" HorizontalAlignment="Center"  VerticalAlignment="Bottom"  Panel.ZIndex="1" Margin="9" Background="#323232" CornerRadius="4">
+            <Grid>
+                <StackPanel Orientation="Horizontal"  VerticalAlignment="Center">
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Text="-" FontSize="20" Foreground="White" Margin="20,0,20,0"></TextBlock>
+                        <TextBlock Text="+" FontSize="20" Foreground="White" Margin="0,0,39,0"></TextBlock>
+                    </StackPanel>
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Text="1" FontSize="20" Foreground="White" Margin="0,0,24,0"></TextBlock>
+                        <TextBlock Text="/" FontSize="20" Foreground="White" Margin="0,0,24,0"></TextBlock>
+                        <TextBlock Text="20" FontSize="20" Foreground="White" Margin="0,0,24,0"></TextBlock>
+                    </StackPanel>
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Text="↑" FontSize="20" Foreground="White" Margin="20,0,20,0"></TextBlock>
+                        <TextBlock Text="↓" FontSize="20" Foreground="White"></TextBlock>
+
+                    </StackPanel>
+                </StackPanel>
+            </Grid>
+        </Border>
+    </Grid>
 </UserControl>