123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- <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:i="http://schemas.microsoft.com/xaml/behaviors"
- mc:Ignorable="d"
- d:DesignHeight="450" d:DesignWidth="800">
-
- <UserControl.Resources>
- <convert:WidthConvert x:Key="WidthConvert"/>
-
-
-
- <Style x:Key="ListViewItemGraySelectStyle" TargetType="{x:Type ListViewItem}">
- <Setter Property="UIElement.SnapsToDevicePixels"
- Value="True" />
- <Setter Property="Control.Padding"
- Value="4,1" />
- <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}"
- Name="Bd"
- SnapsToDevicePixels="True">
- <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="#1A000000" />
- <Setter Property="Border.BorderBrush" TargetName="Bd" Value="#1A000000" />
- </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="#1A477EDE" />
- <Setter Property="Border.BorderBrush" TargetName="Bd" Value="#1A477EDE" />
- </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>
- </UserControl.Resources>
- <Grid Background="#F3F3F3" Width="200">
- <Grid.RowDefinitions>
- <RowDefinition Height="auto"/>
- <RowDefinition Height="auto"/>
- <RowDefinition/>
- </Grid.RowDefinitions>
- <Grid Height="48" >
- <TextBlock Text="查找" HorizontalAlignment="Left" VerticalAlignment="Center"/>
- <Button Content="完成" HorizontalAlignment="Right" VerticalAlignment="Center"/>
- </Grid>
- <Grid Height="48" Grid.Row="1">
- <TextBox Width="150" HorizontalAlignment="Left"/>
- <Button Content="完成" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding SearchTextCommand}"/>
- </Grid>
- <Grid Grid.Row="2">
- <ListView Grid.Row="1" Name="SearchResultList" VirtualizingPanel.IsVirtualizingWhenGrouping="True"
- ItemsSource="{Binding searchResults,Mode=OneWay}"
- BorderThickness="0" ItemContainerStyle="{StaticResource ListViewItemGraySelectStyle}"
- SelectionChanged="SearchResultList_SelectionChanged"
- ScrollViewer.HorizontalScrollBarVisibility="Hidden">
- <ListView.GroupStyle>
- <GroupStyle>
- <GroupStyle.HeaderTemplate>
- <DataTemplate>
- <StackPanel Background="#E2E3E6" Height="24">
- <TextBlock Padding="0,4,12,4" VerticalAlignment="Stretch" TextAlignment="Center" HorizontalAlignment="Right" FontWeight="SemiBold" FontSize="12" Text="{Binding Name}"
- FontFamily="Segoe UI" Foreground="#666666 "/>
- </StackPanel>
- </DataTemplate>
- </GroupStyle.HeaderTemplate>
- <GroupStyle.Panel>
- <ItemsPanelTemplate>
- <VirtualizingStackPanel/>
- </ItemsPanelTemplate>
- </GroupStyle.Panel>
- </GroupStyle>
- </ListView.GroupStyle>
- <ListView.ItemsPanel>
- <ItemsPanelTemplate>
- <VirtualizingStackPanel Background="White" Margin="-5,0,0,0"></VirtualizingStackPanel>
- </ItemsPanelTemplate>
- </ListView.ItemsPanel>
- <ListView.ItemTemplate>
- <ItemContainerTemplate>
- <StackPanel>
- <RichTextBox Background="Transparent" Foreground="#000000" FontFamily="Segoe UI" FontSize="14" IsReadOnly="True" BorderThickness="0"
- Padding="12,6,10,6" VerticalContentAlignment="Center" VerticalAlignment="Center"
- helper:RichTextBoxHelper.DocumentBind="{Binding BindProperty}"
- 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>
- </UserControl>
|