123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <UserControl
- x:Class="PDF_Office.Views.BOTA.BookmarkContent"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:bota="clr-namespace:PDF_Office.ViewModels.BOTA"
- xmlns:convert="clr-namespace:PDF_Office.DataConvert"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:data="clr-namespace:ComPDFKit.PDFDocument;assembly=ComPDFKit.Desk"
- xmlns:helper="clr-namespace:PDF_Office.Helper"
- xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
- xmlns:local="clr-namespace:PDF_Office.Views.BOTA"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:prism="http://prismlibrary.com/"
- d:DataContext="{d:DesignInstance Type=bota:BookmarkContentViewModel}"
- d:DesignHeight="450"
- d:DesignWidth="300"
- prism:ViewModelLocator.AutoWireViewModel="True"
- mc:Ignorable="d">
- <UserControl.Resources>
- <ResourceDictionary>
- <ResourceDictionary.MergedDictionaries>
- <ResourceDictionary Source="pack://application:,,,/Styles/ListViewStyle.xaml" />
- <ResourceDictionary Source="pack://application:,,,/Styles/ButtonStyle.xaml" />
- </ResourceDictionary.MergedDictionaries>
- <convert:BoolToVisible x:Key="BoolToVisibleConvert" />
- <convert:UnVisivleConvert x:Key="UnVisivleConvert" />
- <convert:ObjectConvert x:Key="ObjectConvert" />
- <DataTemplate x:Key="myDataTemplate" DataType="{x:Type data:CPDFBookmark}">
- <StackPanel
- Name="StackPanel"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch">
- <Grid Name="Grid" Margin="15,5">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="10*" />
- <ColumnDefinition Width="90*" />
- </Grid.ColumnDefinitions>
- <!--<Image
- Grid.Column="0"
- Width="16"
- Height="16"
- Source="pack://application:,,,/Resources/BOTA/empty_bookmark.png" />-->
- <Path Grid.Column="0"
- Width="16"
- Height="16" Data="M3 3.47368C3 2.65979 3.65979 2 4.47368 2H11.5263C12.3402 2 13 2.65979 13 3.47368V14.3044C13 14.9486 12.2314 15.2826 11.7604 14.843L8.50276 11.8026C8.21966 11.5384 7.78034 11.5384 7.49724 11.8026L4.2396 14.843C3.7686 15.2826 3 14.9486 3 14.3044V3.47368Z" Fill="#94989C">
- <Path.RenderTransform>
- <TransformGroup>
- <TranslateTransform Y="-3" />
- </TransformGroup>
- </Path.RenderTransform>
- </Path>
- <TextBox
- Name="TxtTitleInput"
- Grid.Column="1"
- Padding="5"
- HorizontalContentAlignment="Left"
- Background="White"
- BorderThickness="1"
- FontSize="14"
- Text="{Binding Title}"
- TextWrapping="Wrap">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="KeyDown">
- <i:InvokeCommandAction Command="{Binding DataContext.KeyDownCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True" />
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </TextBox>
- <TextBlock
- Name="TxbTitle"
- Grid.Column="1"
- Padding="5"
- Background="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=Background}"
- FontSize="14"
- Text="{Binding Title}"
- Visibility="Visible" />
- </Grid>
- </StackPanel>
- </DataTemplate>
- <ContextMenu
- x:Key="ContextMenu"
- DataContext="{Binding PlacementTarget.Tag, RelativeSource={RelativeSource Self}}"
- FontSize="14">
- <MenuItem Click="MenuItemRename_Click" Header="重命名" />
- <MenuItem
- Command="{Binding DataContext.EditPageIndexCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
- CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.DataContext}"
- Header="更改目标位置" />
- <MenuItem Click="MenuItemDeleteCommand_Click" Header="删除" />
- </ContextMenu>
- </ResourceDictionary>
- </UserControl.Resources>
- <Grid Background="#F2F2F2">
- <Grid.RowDefinitions>
- <RowDefinition Height="40" />
- <RowDefinition />
- </Grid.RowDefinitions>
- <Grid MinWidth="190">
- <TextBlock
- x:Name="TxtTitle"
- Margin="12,0,0,0"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- FontSize="18"
- FontWeight="SemiBold"
- Text="Bookmarks" />
- <Button
- Name="BtnAddBookmark"
- Width="40"
- Height="40"
- Margin="0,0,0,0"
- Style="{StaticResource PageEditToolBtn}"
- HorizontalAlignment="Right"
- Command="{Binding AddBookmarkCommand}"
- CommandParameter="{Binding ElementName=BookMarkListView}">
- <Path Data="M13.5 8C13.5 11.0376 11.0376 13.5 8 13.5C4.96243 13.5 2.5 11.0376 2.5 8C2.5 4.96243 4.96243 2.5 8 2.5C11.0376 2.5 13.5 4.96243 13.5 8ZM15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM7.25005 4.80003V7.25003H4.80005V8.75003H7.25005V11.2H8.75005V8.75003H11.2V7.25003H8.75005V4.80003H7.25005Z" Fill="#616469">
- <Path.RenderTransform>
- <TransformGroup>
- <TranslateTransform Y="-3" />
- </TransformGroup>
- </Path.RenderTransform>
- </Path>
- </Button>
- </Grid>
- <Grid Grid.Row="1">
- <ListView
- Name="BookMarkListView"
- HorizontalContentAlignment="Stretch"
- Background="#F2F2F2"
- BorderThickness="0"
- ItemTemplate="{StaticResource myDataTemplate}"
- ItemsSource="{Binding Bookmarklist}"
- PreviewMouseDown="BookMarkListView_PreviewMouseDown"
- ScrollViewer.HorizontalScrollBarVisibility="Disabled"
- VirtualizingPanel.CacheLength="1"
- VirtualizingPanel.CacheLengthUnit="Page"
- VirtualizingPanel.IsVirtualizing="True"
- VirtualizingPanel.ScrollUnit="Pixel">
- <ListView.ItemsPanel>
- <ItemsPanelTemplate>
- <VirtualizingStackPanel Margin="-5,0,0,0" Background="Transparent" />
- </ItemsPanelTemplate>
- </ListView.ItemsPanel>
- <ListView.ItemContainerStyle>
- <Style BasedOn="{StaticResource ListViewItemGraySelectStyle}" TargetType="ListViewItem">
- <EventSetter Event="PreviewMouseDown" Handler="ListViewItem_MouseLeftButtonDown" />
- <EventSetter Event="LostFocus" Handler="ListViewItem_LostFocus" />
- <Setter Property="ContextMenu" Value="{StaticResource ContextMenu}" />
- </Style>
- </ListView.ItemContainerStyle>
- </ListView>
- </Grid>
- <StackPanel
- Name="EmptyPanel"
- Grid.RowSpan="2"
- Width="150"
- VerticalAlignment="Center"
- Visibility="{Binding IsEmptyPanelVisibility}">
- <Image
- Width="140"
- Height="140"
- Source="pack://application:,,,/Resources/BOTA/empty_bookmark.png" />
- <TextBlock
- Name="txtEmpty"
- Margin="0,12,0,0"
- FontFamily="Segoe UI"
- FontSize="16"
- Text="No bookmark"
- TextAlignment="Center" />
- </StackPanel>
- </Grid>
- </UserControl>
|