123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <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="/Styles/ListViewStyle.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}">
- <Grid
- Name="Grid"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- Background="#F2F2F2">
- <Grid.RowDefinitions>
- <RowDefinition Height="40" />
- </Grid.RowDefinitions>
- <StackPanel
- Name="StackPanel"
- Margin="15,5"
- Orientation="Horizontal">
- <Image
- Width="20"
- Height="20"
- Source="\Resources\BOTA\empty_bookmark.png" />
- <!-- IsHitTestVisible="False" -->
- <TextBlock
- Name="TxbTitle"
- Width="180"
- Padding="5"
- Background="Transparent"
- FontSize="14"
- Text="{Binding Title}"
- Visibility="Visible" />
- <TextBox
- Name="TxtTitleInput"
- Width="180"
- Padding="5"
- Background="White"
- BorderThickness="1"
- FontSize="14"
- Text="{Binding Title}"
- TextWrapping="Wrap"
- Visibility="{Binding ElementName=TxbTitle, Path=Visibility, Converter={StaticResource UnVisivleConvert}, Mode=TwoWay}">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="LostFocus">
- <helper:AdvancedInvokeCommandAction
- Command="{Binding DataContext.LostFocusCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
- CommandParameter="{Binding ElementName=TxtTitleInput}"
- PassEventArgsToCommand="True" />
- <!--<i:InvokeCommandAction Command="{Binding DataContext.LostFocusCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True" />-->
- </i:EventTrigger>
- <i:EventTrigger EventName="GotFocus">
- <helper:AdvancedInvokeCommandAction
- Command="{Binding DataContext.GotFocusCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
- CommandParameter="{Binding ElementName=TxtTitleInput}"
- PassEventArgsToCommand="True" />
- <!--<i:InvokeCommandAction Command="{Binding DataContext.GotFocusCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True" />-->
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </TextBox>
- </StackPanel>
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="MouseEnter">
- <!-- 绑定两个或多个参数 -->
- <!--<i:InvokeCommandAction Command="{Binding DataContext.MouseEnterCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True">
- <i:InvokeCommandAction.CommandParameter>
- <MultiBinding Converter="{StaticResource ResourceKey=ObjectConvert}" Mode="TwoWay">
- <MultiBinding.Bindings>
- <Binding ElementName="Grid" />
- <Binding ElementName="TxtTitleInput" />
- </MultiBinding.Bindings>
- </MultiBinding>
- </i:InvokeCommandAction.CommandParameter>
- </i:InvokeCommandAction>-->
- <!-- 绑定两个参数 -->
- <helper:AdvancedInvokeCommandAction
- Command="{Binding DataContext.MouseEnterCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
- CommandParameter="{Binding ElementName=Grid}"
- PassEventArgsToCommand="True" />
- <!-- 绑定多个参数 -->
- <!--<helper:AdvancedInvokeCommandAction Command="{Binding DataContext.MouseEnterCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True">
- <helper:AdvancedInvokeCommandAction.CommandParameter>
- <MultiBinding Converter="{StaticResource ResourceKey=ObjectConvert}" Mode="TwoWay">
- <MultiBinding.Bindings>
- <Binding ElementName="Grid" />
- <Binding ElementName="TextBlockTitle" />
- </MultiBinding.Bindings>
- </MultiBinding>
- </helper:AdvancedInvokeCommandAction.CommandParameter>
- </helper:AdvancedInvokeCommandAction>-->
- <!-- 绑定一个参数 -->
- <!--<i:InvokeCommandAction Command="{Binding DataContext.MouseEnterCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True" />-->
- </i:EventTrigger>
- <i:EventTrigger EventName="MouseLeave">
- <helper:AdvancedInvokeCommandAction
- Command="{Binding DataContext.MouseLeaveCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
- CommandParameter="{Binding ElementName=Grid}"
- PassEventArgsToCommand="True" />
- <!--<i:InvokeCommandAction Command="{Binding DataContext.MouseLeaveCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" PassEventArgsToCommand="True" />-->
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </Grid>
- </DataTemplate>
- </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"
- HorizontalAlignment="Right"
- Command="{Binding AddBookmarkCommand}"
- CommandParameter="{Binding ElementName=BookMarkListView}"
- Content="添加" />
- </Grid>
- <Grid Grid.Row="1">
- <ListView
- Name="BookMarkListView"
- HorizontalContentAlignment="Stretch"
- Background="#F2F2F2"
- BorderThickness="0"
- ItemTemplate="{StaticResource myDataTemplate}"
- ItemsSource="{Binding Bookmarklist}"
- 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="PreviewMouseLeftButtonDown" Handler="ListViewItem_MouseLeftButtonDown" />
- <!--<EventSetter Event="PreviewMouseMove" Handler="ListViewItem_PreviewMouseMove" />
- <EventSetter Event="MouseLeave" Handler="ListViewItem_MouseLeave" />-->
- <!--<EventSetter Event="Unselected" Handler="ListViewItem_Unselected" />-->
- </Style>
- </ListView.ItemContainerStyle>
- </ListView>
- </Grid>
- <StackPanel
- Name="EmptyPanel"
- Grid.RowSpan="2"
- Width="150"
- VerticalAlignment="Center"
- Visibility="{Binding IsEmptyPanelVisibility}">
- <Image
- Width="140"
- Height="140"
- Source="\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>
|