1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <UserControl x:Class="PDF_Master.Views.EditTools.Watermark.WatermarkTemplateListFileContent"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:prism="http://prismlibrary.com/"
- prism:ViewModelLocator.AutoWireViewModel="True"
- xmlns:data ="clr-namespace:PDFSettings;assembly=PDFSettings"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d"
- d:DesignHeight="632"
- d:DesignWidth="260">
- <UserControl.Resources>
- <ContextMenu x:Key="FlyoutMenu" FontSize="14" >
- <ContextMenu.ItemContainerStyle>
- <Style TargetType="{x:Type MenuItem}">
- <Setter Property="Padding" Value="0,8,0,8"/>
- <Setter Property="VerticalContentAlignment" Value="Center"/>
- </Style>
- </ContextMenu.ItemContainerStyle>
- <MenuItem Name="MenuEdit" Header="编辑模板" Click="MenuEdit_Click" >
- </MenuItem>
- <MenuItem Name="MenuDeleteCurrent" Header="删除模板" Click="MenuDeleteCurrent_Click">
- </MenuItem>
- <MenuItem Name="MenuDeleteAll" Header="删除全部" Click="MenuDeleteAll_Click"></MenuItem>
- </ContextMenu>
- </UserControl.Resources>
- <Grid Background="#F3F3F3">
- <ListBox Name="FileWatermarkListbox"
- Width="240"
- BorderThickness="0"
- ScrollViewer.CanContentScroll="True"
- ScrollViewer.HorizontalScrollBarVisibility="Disabled"
- ScrollViewer.VerticalScrollBarVisibility="Hidden"
- VirtualizingPanel.IsVirtualizing="True"
- VirtualizingPanel.VirtualizationMode="Standard"
- VirtualizingPanel.CacheLengthUnit="Page"
- VirtualizingPanel.CacheLength="1"
- VirtualizingPanel.ScrollUnit="Pixel"
- Background="#F3F3F3"
- ItemsSource="{Binding WatermarkModFileCollection}"
- SelectionChanged="ListBox_SelectionChanged">
- <ListBox.ItemContainerStyle>
- <Style TargetType="ListBoxItem">
- <Setter Property="Margin" Value="20"/>
- <Setter Property="Padding" Value="0 0 0 0"/>
- <Setter Property="Height" Value="160"/>
- <Setter Property="Width" Value="128"/>
- <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"/>
- <Setter Property="Template" Value="{DynamicResource EditToolsItemControlTemplate}"/>
- </Style>
- </ListBox.ItemContainerStyle>
- <ListBox.ItemTemplate>
- <DataTemplate DataType="{x:Type data:WatermarkItem}">
- <StackPanel Name="itemPanel" Loaded="itemPanel_Loaded">
- <Grid Height="160" Width=" 128" >
- <Image Name="WatermarkPreview" Stretch="Fill" RenderOptions.BitmapScalingMode="HighQuality" />
- <CheckBox Name="IsSelectedCheckBox" Height="14" Width="14" HorizontalAlignment="Right" VerticalAlignment="Top" Panel.ZIndex="1" IsChecked="True" IsEnabled="False"/>
- <Button Name="EditTemplateBtn" Height="43" Width="63" HorizontalAlignment="Left" VerticalAlignment="Bottom" Click="EditTemplateBtn_Click"></Button>
- <Button Name="DeleteTemplateBtn" Height="43" Width="63" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="DeleteTemplateBtn_Click" >
- </Button>
- </Grid>
- </StackPanel>
- <DataTemplate.Triggers>
- <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}" Value="True">
- <Setter TargetName="IsSelectedCheckBox" Property="Visibility" Value="Visible"/>
- </DataTrigger>
- <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}" Value="False">
- <Setter TargetName="IsSelectedCheckBox" Property="Visibility" Value="Collapsed"/>
- </DataTrigger>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="EditTemplateBtn" Property="Visibility" Value="Visible"/>
- <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Visible"/>
- </Trigger>
- <Trigger Property="IsMouseOver" Value="False">
- <Setter TargetName="EditTemplateBtn" Property="Visibility" Value="Collapsed"/>
- <Setter TargetName="DeleteTemplateBtn" Property="Visibility" Value="Collapsed"/>
- </Trigger>
- </DataTemplate.Triggers>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- <Grid Width="140" Margin="64,154,56,312" Visibility="{Binding CreateTemplateVisible, Mode=OneWay}">
- <StackPanel Orientation="Vertical">
- <Label Height="87" Width="87" HorizontalAlignment="Center" Background="BlueViolet"></Label>
- <TextBlock Height="24" FontSize="14" Text="请先创建一个水印模板" Margin="0,8,0,0" VerticalAlignment="Center" ></TextBlock>
- <Button Height="24" Width="44" Margin="0,12,0,0" Content ="新建" Command="{Binding AddTemplateCommand}"></Button>
- </StackPanel>
- </Grid>
- </Grid>
- </UserControl>
|