Browse Source

属性面板 - 调整显示面板UI方式

chenrongqian 2 years ago
parent
commit
959b8242a2

+ 2 - 1
PDF Office/App.xaml.cs

@@ -30,7 +30,7 @@ using PDF_Office.Views.Dialog.PageEditDialogs;
 using PDF_Office.Helper;
 using PDF_Office.Views.Dialog.HomePageToolsDialogs ;
 using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter;
-
+using PDF_Office.Views.PropertyPanel;
 
 namespace PDF_Office
 {
@@ -109,6 +109,7 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<HomeToolsContent>("Tools");
             containerRegistry.RegisterForNavigation<HomeGuidContent>("Guid");
             containerRegistry.RegisterForNavigation<BOTAContent>();
+            containerRegistry.RegisterForNavigation<PropertyPanelContent>();
             containerRegistry.RegisterForNavigation<PageEditContent>();
             containerRegistry.RegisterForNavigation<ToolsBarContent>();
             containerRegistry.RegisterForNavigation<AnnotToolContent>();

+ 30 - 2
PDF Office/ViewModels/PropertyPanel/PropertyPanelContentViewModel.cs

@@ -14,7 +14,7 @@ namespace PDF_Office.ViewModels.PropertyPanel
         AnnotType,
         WaterMarkType,
     }
-    public class PropertyPanelContentViewModel : BindableBase
+    public class PropertyPanelContentViewModel : BindableBase, INavigationAware
     {
         private string _annotPanelType = "HighLight";
         public string AnnotPanelType
@@ -37,10 +37,38 @@ namespace PDF_Office.ViewModels.PropertyPanel
             }
         }
 
+        private IRegionManager regions { get; set; }
+        private string propertyPanelRegionNmae;
+        public string PropertyPanelRegionNmae
+        {
+            get { return propertyPanelRegionNmae; }
+            set
+            {
+                SetProperty(ref propertyPanelRegionNmae, value);
+            }
+        }
 
-        public PropertyPanelContentViewModel()
+        public PropertyPanelContentViewModel(IRegionManager regionManager)
         {
+            regions = regionManager;
+
+            PropertyPanelRegionNmae = Guid.NewGuid().ToString();
+
+        }
 
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+           
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+          
         }
     }
 }

+ 10 - 1
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -394,7 +394,16 @@ namespace PDF_Office.ViewModels
                 NavigationParameters parameters = new NavigationParameters();
                 parameters.Add(ParameterNames.PDFViewer, PDFViewer);
                 parameters.Add(ParameterNames.ViewContentViewModel, this);
-                region.RequestNavigate(BOTARegionName, "BOTAContent",parameters);
+                region.RequestNavigate(BOTARegionName, "BOTAContent", parameters);
+            }
+            ));
+
+            System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
+            {
+                NavigationParameters parameters = new NavigationParameters();
+                parameters.Add(ParameterNames.PDFViewer, PDFViewer);
+                parameters.Add(ParameterNames.ViewContentViewModel, this);
+                region.RequestNavigate(PropertyRegionName, "PropertyPanelContent", parameters);
             }
             ));
         }

+ 1 - 1
PDF Office/Views/PropertyPanel/AnnotPanel/TextAnnotProperty.xaml

@@ -14,7 +14,7 @@
             </ResourceDictionary.MergedDictionaries>
         </ResourceDictionary>
     </UserControl.Resources>
-    <Grid  Width="250" VerticalAlignment="Stretch" Background="Wheat">
+    <Grid  VerticalAlignment="Stretch" Background="Wheat">
         <StackPanel Margin="12 0 12 0">
             <TextBlock Name="AnnotTypeTitle" FontFamily="Segoe UI" FontWeight="Bold" FontSize="18" LineHeight="24" HorizontalAlignment="Center" Margin="0,8,0,0"></TextBlock>
             <Border Width="232" Height="80" BorderThickness="1" BorderBrush="#E2E3E6" Margin="0,8,0,0">

+ 8 - 6
PDF Office/Views/PropertyPanel/PropertyPanelContent.xaml

@@ -8,19 +8,21 @@
               xmlns:Convert="clr-namespace:PDF_Office.DataConvert"
              xmlns:prism="http://prismlibrary.com/"             
              prism:ViewModelLocator.AutoWireViewModel="True"
+             xmlns:PropertyPanel="clr-namespace:PDF_Office.ViewModels.PropertyPanel"
+             d:DataContext="{d:DesignInstance Type=PropertyPanel:PropertyPanelContentViewModel}"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <UserControl.Resources>
         <Convert:PropertyPanelVisible x:Key="PropertyPanelVisible"/>
     </UserControl.Resources>
-    <Grid >
+    <Grid  VerticalAlignment="Stretch">
         <Grid x:Name="GridAnnot">
-            <!--<AnnotPanel:TextAnnotProperty x:Name="textAnnotProperty"  Visibility="{Binding AnnotPanelType,ConverterParameter=HighLight, Converter={StaticResource PropertyPanelVisible}}"/>
-            <AnnotPanel:FreetextAnnotProperty  x:Name="freetextAnnotProperty" Visibility="{Binding AnnotPanelType,ConverterParameter=Freetext,Converter={StaticResource PropertyPanelVisible}}"/>
-            <AnnotPanel:SharpsAnnotProperty  x:Name="sharpsAnnotProperty" Visibility="{Binding AnnotPanelType,ConverterParameter=HighLight,Converter={StaticResource PropertyPanelVisible}}"/>-->
-            <!--<AnnotPanel:StampAnnotProperty  x:Name="stampAnnotProperty" Visibility="{Binding AnnotPanelType,ConverterParameter=HighLight,Converter={StaticResource PropertyPanelVisible}}"/>-->
+            <AnnotPanel:TextAnnotProperty x:Name="textAnnotProperty"  Visibility="{Binding AnnotPanelType,ConverterParameter=HighLight, Converter={StaticResource PropertyPanelVisible}}"/>
+            <!--<AnnotPanel:FreetextAnnotProperty  x:Name="freetextAnnotProperty" Visibility="{Binding AnnotPanelType,ConverterParameter=Freetext,Converter={StaticResource PropertyPanelVisible}}"/>
+            <AnnotPanel:SharpsAnnotProperty  x:Name="sharpsAnnotProperty" Visibility="{Binding AnnotPanelType,ConverterParameter=HighLight,Converter={StaticResource PropertyPanelVisible}}"/>
+            <AnnotPanel:StampAnnotProperty  x:Name="stampAnnotProperty" Visibility="{Binding AnnotPanelType,ConverterParameter=HighLight,Converter={StaticResource PropertyPanelVisible}}"/>
             <AnnotPanel:FreehandAnnotProperty  x:Name="freehandAnnotProperty" Visibility="{Binding AnnotPanelType,ConverterParameter=HighLight,Converter={StaticResource PropertyPanelVisible}}"/>
-            <!--<AnnotPanel:ImageAnnotProperty  x:Name="imageAnnotProperty" Visibility="{Binding AnnotPanelType,ConverterParameter=HighLight,Converter={StaticResource PropertyPanelVisible}}"/>
+            <AnnotPanel:ImageAnnotProperty  x:Name="imageAnnotProperty" Visibility="{Binding AnnotPanelType,ConverterParameter=HighLight,Converter={StaticResource PropertyPanelVisible}}"/>
             <AnnotPanel:LinkAnnotProperty  x:Name="linkAnnotProperty" Visibility="{Binding AnnotPanelType,ConverterParameter=HighLight,Converter={StaticResource PropertyPanelVisible}}"/>-->
 
         </Grid>

+ 1 - 3
PDF Office/Views/PropertyPanel/PropertyPanelContent.xaml.cs

@@ -21,12 +21,10 @@ namespace PDF_Office.Views.PropertyPanel
     /// </summary>
     public partial class PropertyPanelContent : UserControl
     {
-
-
         public PropertyPanelContent()
         {
             InitializeComponent();
-      
+
         }
 
     }

+ 1 - 3
PDF Office/Views/ViewContent.xaml

@@ -8,7 +8,6 @@
     xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
     xmlns:local="clr-namespace:PDF_Office.Views"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-    xmlns:PropertyPanel="clr-namespace:PDF_Office.Views.PropertyPanel"
     xmlns:prism="http://prismlibrary.com/"
     xmlns:viewmodels="clr-namespace:PDF_Office.ViewModels"
     d:DataContext="{d:DesignInstance Type=viewmodels:ViewContentViewModel}"
@@ -170,7 +169,7 @@
                     Width="*"
                     MinWidth="200" />
                 <ColumnDefinition Width="12" />
-                <ColumnDefinition Name="PropertyColumn" Width="0" />
+                <ColumnDefinition Name="PropertyColumn" Width="250" />
             </Grid.ColumnDefinitions>
             <ContentControl prism:RegionManager.RegionName="{Binding BOTARegionName}" />
             <GridSplitter
@@ -188,7 +187,6 @@
             <ContentControl Grid.Column="4" prism:RegionManager.RegionName="{Binding PropertyRegionName}" />
         </Grid>
 
-        <PropertyPanel:PropertyPanelContent Grid.Row="2" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
         <local:BottomToolContent Grid.Row="3" />
 
         <!--  用于显示页面编辑、水印、背景、标记密文等功能的区域  -->