123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426 |
- <UserControl x:Class="PDF_Office.Views.BOTA.SearchContent"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:PDF_Office.Views.BOTA"
- xmlns:prism="http://prismlibrary.com/"
- prism:ViewModelLocator.AutoWireViewModel="True"
- xmlns:bota="clr-namespace:PDF_Office.ViewModels.BOTA"
- d:DataContext="{d:DesignInstance Type=bota:SearchContentViewModel}"
- xmlns:helper="clr-namespace:PDF_Office.Helper"
- xmlns:convert="clr-namespace:PDF_Office.DataConvert"
- xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
- xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
- mc:Ignorable="d"
- Loaded="UserControl_Loaded"
- KeyDown="UserControl_KeyDown"
- d:DesignHeight="450" d:DesignWidth="800">
- <UserControl.Resources>
- <convert:WidthConvert x:Key="WidthConvert"/>
- <convert:BoolToVisible x:Key="BoolToVisible"/>
- <convert:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert"/>
- <convert:ListCountToVisible x:Key="ListCountToVisible" />
- <convert:UnVisivleConvert x:Key="UnVisivleConvert" />
- <Style x:Key="ListViewItemGraySelectStyle" TargetType="{x:Type ListViewItem}">
- <Setter Property="Visibility" Value="{Binding TextProperty.ItemVisibility}" />
- <Setter Property="UIElement.SnapsToDevicePixels"
- Value="True" />
- <Setter Property="Control.Padding"
- Value="0" />
- <Setter Property="Control.HorizontalContentAlignment">
- <Setter.Value>
- <Binding Path="HorizontalContentAlignment"
- RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
- </Setter.Value>
- </Setter>
- <Setter Property="Control.VerticalContentAlignment">
- <Setter.Value>
- <Binding Path="VerticalContentAlignment"
- RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
- </Setter.Value>
- </Setter>
- <Setter Property="Panel.Background"
- Value="#00FFFFFF" />
- <Setter Property="Border.BorderBrush"
- Value="#00FFFFFF" />
- <Setter Property="Border.BorderThickness"
- Value="1" />
- <Setter Property="FrameworkElement.FocusVisualStyle">
- <Setter.Value>
- <Style TargetType="{x:Type IFrameworkInputElement}">
- <Setter Property="Control.Template">
- <Setter.Value>
- <ControlTemplate>
- <Rectangle Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
- StrokeThickness="1"
- StrokeDashArray="1 2"
- Margin="2"
- SnapsToDevicePixels="True" />
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Setter.Value>
- </Setter>
- <Setter Property="Control.Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ListViewItem}">
- <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
- Padding="{TemplateBinding Control.Padding}"
- BorderBrush="{TemplateBinding Border.BorderBrush}"
- Background="{TemplateBinding Panel.Background}"
- CornerRadius="4"
- Name="Bd"
- SnapsToDevicePixels="True">
- <Border.ContextMenu>
- <ContextMenu>
- <MenuItem Header="加入新圆形" Tag="Round" Click="Create_Click"/>
- <MenuItem Header="加入新四边形" Tag="Rectangle" Click="Create_Click"/>
- <MenuItem Header="加入新高亮" Tag="Highlight" Click="Create_Click"/>
- <MenuItem Header="加入新下划线" Tag="Underline" Click="Create_Click"/>
- <MenuItem Header="加入新删除线" Tag="Strikethrough" Click="Create_Click"/>
- </ContextMenu>
- </Border.ContextMenu>
- <ContentPresenter Content="{TemplateBinding ContentControl.Content}"
- ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
- ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
- HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
- SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
- </Border>
- <ControlTemplate.Triggers>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="UIElement.IsMouseOver" Value="True" />
- </MultiTrigger.Conditions>
- <Setter Property="Panel.Background" TargetName="Bd" Value="{StaticResource color.item-state.sel.bg.lv3}"/>
- <Setter Property="Border.BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.sel.border.lv3}"/>
- </MultiTrigger>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="Selector.IsSelectionActive" Value="False" />
- <Condition Property="Selector.IsSelected" Value="True" />
- </MultiTrigger.Conditions>
- <Setter Property="Panel.Background" TargetName="Bd" Value="#1A477EDE" />
- <Setter Property="Border.BorderBrush" TargetName="Bd" Value="#1A477EDE" />
- </MultiTrigger>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="Selector.IsSelectionActive" Value="True" />
- <Condition Property="Selector.IsSelected" Value="True" />
- </MultiTrigger.Conditions>
- <Setter Property="Panel.Background" TargetName="Bd" Value="{StaticResource color.item-state.sel.bg.lv3}" />
- <Setter Property="Border.BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.sel.border.lv3}" />
- </MultiTrigger>
- <Trigger Property="UIElement.IsEnabled" Value="False">
- <Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="CustomizeMenuItem" TargetType="{x:Type MenuItem}">
- <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="Height" Value="32" />
- <Setter Property="Margin" Value="8,0" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type MenuItem}">
- <Border
- x:Name="Border"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="0"
- CornerRadius="7">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition
- x:Name="ColIcon"
- Width="Auto"
- SharedSizeGroup="MenuItemIconColumnGroup" />
- <ColumnDefinition Width="Auto" SharedSizeGroup="MenuTextColumnGroup" />
- <ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup" />
- <ColumnDefinition x:Name="ColNext" Width="auto" />
- </Grid.ColumnDefinitions>
- <ContentPresenter
- x:Name="Icon"
- Grid.Column="0"
- Margin="5,0"
- VerticalAlignment="Center"
- ContentSource="Icon" />
- <Grid
- x:Name="GlyphPanel"
- Grid.Column="0"
- Margin="5,0"
- VerticalAlignment="Center"
- Visibility="Hidden">
- <Viewbox
- Width="18"
- Height="18"
- VerticalAlignment="Center"
- FlowDirection="LeftToRight">
- <Path Data="M422.36247 839.786465c-13.320377 13.421684-34.909068 13.421684-48.126091 0l-10.69355-10.800997 0 0-11.398608-11.502985-50.145074-50.544163c-0.097214-0.201591 0-0.500397-0.201591-0.604774L72.380494 533.085224c-13.320377-13.421684-13.320377-35.218106 0-48.535413l72.132854-72.842005c13.319353-13.408381 34.907021-13.408381 48.224328 0l205.814506 209.252815L831.363631 184.208419c13.218046-13.414521 34.806737-13.414521 48.124044 0l72.134901 72.842005c13.317307 13.408381 13.317307 35.113729 0 48.52211L422.36247 839.786465 422.36247 839.786465z" Fill="{TemplateBinding Foreground}" />
- </Viewbox>
- </Grid>
- <ContentPresenter
- x:Name="HeaderHost"
- Grid.Column="1"
- Margin="{TemplateBinding Padding}"
- VerticalAlignment="Center"
- ContentSource="Header"
- RecognizesAccessKey="True" />
- <ContentPresenter
- x:Name="IGTHost"
- Grid.Column="2"
- Margin="8,0"
- VerticalAlignment="Center"
- ContentSource="InputGestureText" />
- <Grid
- x:Name="ArrowPanel"
- Grid.Column="3"
- Margin="10,0"
- HorizontalAlignment="Right"
- VerticalAlignment="Center">
- <Path
- x:Name="ArrowPanelPath"
- HorizontalAlignment="Right"
- VerticalAlignment="Center"
- Data="M0,0 L0,8 L4,4 z"
- Fill="{TemplateBinding Foreground}" />
- </Grid>
- <Popup
- x:Name="SubMenuPopup"
- AllowsTransparency="True"
- Focusable="false"
- IsOpen="{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
- Placement="Right">
- <Border
- x:Name="SubMenuBorder"
- Padding="2,2,2,2"
- Background="{StaticResource color.sys.layout.mg}"
- BorderBrush="#999999"
- BorderThickness="0"
- CornerRadius="7">
- <Grid x:Name="SubMenu" Grid.IsSharedSizeScope="True">
- <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
- </Grid>
- </Border>
- </Popup>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="Role" Value="TopLevelHeader">
- <Setter Property="Padding" Value="6,1" />
- <Setter Property="Background" Value="Transparent" />
- <Setter TargetName="SubMenuPopup" Property="Placement" Value="Bottom" />
- <Setter TargetName="ColIcon" Property="MinWidth" Value="0" />
- <Setter TargetName="ColNext" Property="Width" Value="Auto" />
- <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
- <Setter TargetName="GlyphPanel" Property="Visibility" Value="Collapsed" />
- <Setter TargetName="IGTHost" Property="Visibility" Value="Collapsed" />
- <Setter TargetName="ArrowPanel" Property="Visibility" Value="Collapsed" />
- </Trigger>
- <Trigger Property="IsHighlighted" Value="true">
- <Setter TargetName="Border" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv1}" />
- <Setter Property="Foreground" Value="{StaticResource color.sys.text.accent.norm}" />
- </Trigger>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsHighlighted" Value="True" />
- <Condition Property="Role" Value="TopLevelHeader" />
- </MultiTrigger.Conditions>
- <MultiTrigger.Setters>
- <Setter TargetName="Border" Property="Background" Value="#0cffffff" />
- </MultiTrigger.Setters>
- </MultiTrigger>
- <Trigger Property="Role" Value="TopLevelItem">
- <Setter Property="Padding" Value="6,1" />
- <Setter TargetName="ArrowPanel" Property="Visibility" Value="Collapsed" />
- </Trigger>
- <Trigger Property="Role" Value="SubmenuHeader">
- <Setter Property="Padding" Value="5,2" />
- </Trigger>
- <Trigger Property="Role" Value="SubmenuItem">
- <Setter Property="Padding" Value="5,2" />
- <Setter TargetName="ArrowPanel" Property="Visibility" Value="Collapsed" />
- </Trigger>
- <Trigger Property="Icon" Value="{x:Null}">
- <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
- </Trigger>
- <Trigger Property="IsChecked" Value="true">
- <Setter TargetName="GlyphPanel" Property="Visibility" Value="Visible" />
- <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
- </Trigger>
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.dis}" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <PathGeometry x:Key="Ic_MoreButtonPath" Figures="M5.83333 12.5C8.13452 12.5 10 10.6345 10 8.33333C10 6.03215 8.13452 4.16667 5.83333 4.16667C3.53215 4.16667 1.66667 6.03215 1.66667 8.33333C1.66667 10.6345 3.53215 12.5 5.83333 12.5ZM5.83333 14.1667C6.8191 14.1667 7.74775 13.9222 8.56195 13.4905L12.4581 17.3866L13.6366 16.2081L9.92222 12.4937C10.9989 11.4354 11.6667 9.96235 11.6667 8.33333C11.6667 5.11167 9.05499 2.5 5.83333 2.5C2.61167 2.5 0 5.11167 0 8.33333C0 11.555 2.61167 14.1667 5.83333 14.1667ZM13.5059 7.65166L16.1576 10.3033L18.8092 7.65166L19.9877 8.83017L16.7468 12.0711C16.4214 12.3965 15.8938 12.3965 15.5683 12.0711L12.3274 8.83017L13.5059 7.65166Z"/>
- <PathGeometry x:Key="Ic_ExpandButtonPath" Figures="M5.99993 7.56427L2.03033 3.59467L0.969666 4.65533L5.4696 9.15526C5.7625 9.44816 6.23737 9.44816 6.53026 9.15526L11.0302 4.65533L9.96954 3.59467L5.99993 7.56427Z"/>
- <PathGeometry x:Key="Ic_ShrinkButtonPath" Figures="M7.56432 5.99996L3.59467 9.96961L4.65533 11.0303L9.15531 6.53029C9.4482 6.2374 9.4482 5.76252 9.15531 5.46963L4.65533 0.969645L3.59467 2.0303L7.56432 5.99996Z"/>
- </UserControl.Resources>
- <Grid Background="#F3F3F3">
- <Grid.RowDefinitions>
- <RowDefinition Height="auto"/>
- <RowDefinition Height="auto"/>
- <RowDefinition/>
- </Grid.RowDefinitions>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="16"/>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="16"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="13"/>
- <RowDefinition Height="auto"/>
- <RowDefinition Height="8"/>
- <RowDefinition Height="auto"/>
- <RowDefinition Height="18"/>
- </Grid.RowDefinitions>
- <Grid Grid.Column="1" Grid.Row="1">
- <TextBlock Text="查找" HorizontalAlignment="Left" VerticalAlignment="Center"/>
- <Button Content="完成" Height="24" Width="45" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource Btn.cta}" Visibility="{Binding Completed}" Command="{Binding CleanCommand}"/>
- </Grid>
- <customControl:TextBoxEx x:Name="SearchText" Initialized="TextBoxEx_Initialized" Grid.Column="1" Grid.Row="3" Height="32" Padding="14,0,0,0" HorizontalAlignment="Stretch" KeyDown="TextBox_KeyDown" >
- <customControl:TextBoxEx.ContextMenu>
- <ContextMenu Name="ContextSearchText" Width="180">
- <MenuItem x:Name="IgnoreItem" Style="{StaticResource CustomizeMenuItem}" Header="Ignore Case" IsCheckable="True" IsChecked="{Binding CaseInsensitive,Mode=TwoWay}"/>
- <Separator x:Name="IgnoreSeparator" Style="{StaticResource HorizontalSeparatorStyle}"/>
- <Separator x:Name="ClearSeparator" Style="{StaticResource HorizontalSeparatorStyle}"/>
- <MenuItem x:Name="ClearItem" Style="{StaticResource CustomizeMenuItem}" Header="Clear Search History" Click="ClearItem_Click"/>
- </ContextMenu>
- </customControl:TextBoxEx.ContextMenu>
- </customControl:TextBoxEx>
- <customControl:PathButton HorizontalAlignment="Left" Grid.Column="1" Grid.Row="3"
- Click="PathButton_Click"
- Margin="8,0,0,0"
- Width="20"
- Height="20"
- Icon="{StaticResource Ic_MoreButtonPath}"
- IconFill="#616469"
- IconHeight="20"
- IconMouseOver="{StaticResource Ic_MoreButtonPath}"
- IconMouseOverFill="#616469"
- IconPress="{StaticResource Ic_MoreButtonPath}"
- IconPressFill="#616469"
- IconWidth="20"
- CornerRadius="4"
- MouseOverBackground="{StaticResource color.item-state.hov.bg}"
- MouseDownBackground="{StaticResource color.item-state.sel.bg.lv3}"
- MouseDownBorderBrush="{StaticResource color.item-state.sel.border.lv3}"
- />
- </Grid>
- <Grid Grid.Row="1" Margin="10,0,10,0" Visibility="{Binding ElementName=NoSearch,Path=Visibility, Converter={StaticResource UnVisivleConvert}}">
- <TextBlock Margin="0,0,0,10" Text="All Result" VerticalAlignment="Center" HorizontalAlignment="Left"/>
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
- <TextBlock Margin="0,0,0,10" Text="Results:" VerticalAlignment="Center" HorizontalAlignment="Right"/>
- <TextBlock x:Name="TbCount" Margin="0,0,0,10" Text="{Binding SearchCount}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
- </StackPanel>
- </Grid>
- <Grid Grid.Row="2" >
- <ListView Name="SearchResultList" VirtualizingPanel.IsVirtualizingWhenGrouping="True"
- ItemsSource="{Binding SearchItemList}"
- BorderThickness="0" ItemContainerStyle="{StaticResource ListViewItemGraySelectStyle}"
- ScrollViewer.HorizontalScrollBarVisibility="Hidden">
- <ListView.GroupStyle>
- <GroupStyle >
- <GroupStyle.HeaderTemplate>
- <DataTemplate>
- <Border Background="{StaticResource color.sys.layout.fg.light}" Height="32" Padding="16,5,5,5" VerticalAlignment="Center" >
- <Grid VerticalAlignment="Center">
- <TextBlock VerticalAlignment="Stretch" TextAlignment="Center" HorizontalAlignment="Left" FontSize="14" Text="{Binding Name}"
- FontWeight="Regular" FontFamily="SF Pro Text" Foreground="{StaticResource color.sys.text.neutral.lv1}"/>
- <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
- <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center" FontWeight="Regular" FontSize="14" Text="{Binding Items.Count}"
- FontFamily="SF Pro Text" Foreground="{StaticResource color.sys.text.neutral.lv3}"/>
- <customControl:PathButton HorizontalAlignment="Center" VerticalAlignment="Center"
- Click="BtnExptend_Click"
- Height="24" Width="24" IconHeight="12" IconWidth="12"
- HorizontalContentAlignment="Center"
- VerticalContentAlignment="Center"
- Icon="{StaticResource Ic_ExpandButtonPath}" IconFill="#616469"
- IconPress="{StaticResource Ic_ExpandButtonPath}" IconPressFill="#616469"
- IconMouseOver="{StaticResource Ic_ExpandButtonPath}" IconMouseOverFill="#616469"
- IconChecked="{StaticResource Ic_ShrinkButtonPath}" IconCheckedFill="#616469" />
- </StackPanel>
- </Grid>
- </Border>
- </DataTemplate>
- </GroupStyle.HeaderTemplate>
- <GroupStyle.Panel >
- <ItemsPanelTemplate>
- <VirtualizingStackPanel Visibility="Visible"/>
- </ItemsPanelTemplate>
- </GroupStyle.Panel>
- </GroupStyle>
- </ListView.GroupStyle>
- <ListView.ItemsPanel>
- <ItemsPanelTemplate>
- <VirtualizingStackPanel Background="{StaticResource color.sys.layout.mg}" Margin="-5,0,0,0"></VirtualizingStackPanel>
- </ItemsPanelTemplate>
- </ListView.ItemsPanel>
- <ListView.ItemTemplate>
- <ItemContainerTemplate>
- <StackPanel>
- <RichTextBox Background="Transparent" Foreground="{StaticResource color.sys.text.neutral.lv1}" FontFamily="Segoe UI" FontSize="14" IsReadOnly="True" BorderThickness="0"
- FontWeight="Regular" Padding="12,6,10,6" VerticalContentAlignment="Center" VerticalAlignment="Center"
- helper:RichTextBoxHelper.DocumentBind="{Binding TextProperty}" Cursor="Arrow"
- Width="{Binding ElementName=SearchResultList,Path=ActualWidth,Converter={StaticResource WidthConvert}}"
- IsHitTestVisible="False">
- </RichTextBox>
- </StackPanel>
- </ItemContainerTemplate>
- </ListView.ItemTemplate>
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="SelectionChanged">
- <i:InvokeCommandAction Command="{Binding SearchChangedCommand}" CommandParameter="{Binding ElementName=SearchResultList,Path=SelectedItem}"/>
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </ListView>
- </Grid>
- <Grid x:Name="NoSearch" Grid.Row="0" Grid.RowSpan="3" Visibility="{Binding SearchItemList.Count, Converter={StaticResource ListCountToVisible}}">
- <StackPanel VerticalAlignment="Center" >
- <Image Source="pack://application:,,,/PDF Office;component/Resources/BOTA/no search.png" />
- <TextBlock
- Height="22"
- HorizontalAlignment="Center"
- FontFamily="Segoe UI"
- FontSize="14"
- Text="No search results" />
- <TextBlock
- Width="168"
- HorizontalAlignment="Center"
- FontFamily="Segoe UI"
- FontSize="12"
- Foreground="#94989C"
- TextAlignment="Center"
- Text="Search requests can be entered above."
- TextWrapping="Wrap" />
- </StackPanel>
- </Grid>
- </Grid>
- </UserControl>
|