123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <UserControl
- x:Class="PDF_Master.Views.Dialog.PageEditDialogs.InsertDialog"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:convert="clr-namespace:PDF_Master.DataConvert"
- xmlns:cus="clr-namespace:PDF_Master.CustomControl"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
- xmlns:local="clr-namespace:PDF_Master.Views.Dialog.PageEditDialogs"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:model="clr-namespace:PDF_Master.Model.PageEdit"
- xmlns:pageeditdialogs="clr-namespace:PDF_Master.ViewModels.Dialog.PageEditDialogs"
- xmlns:prism="http://prismlibrary.com/"
- Width="480"
- Height="472"
- d:DataContext="{d:DesignInstance Type=pageeditdialogs:InsertDialogViewModel}"
- d:DesignHeight="450"
- d:DesignWidth="800"
- prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
- prism:ViewModelLocator.AutoWireViewModel="True"
- mc:Ignorable="d">
- <UserControl.Resources>
- <ResourceDictionary>
- <convert:FileToImageSourceConvert x:Key="FileToImageSourceConvert" />
- <DataTemplate x:Key="CustomItem" DataType="{x:Type model:CustomPageItem}">
- <StackPanel HorizontalAlignment="Center">
- <Border
- Name="BdBorder"
- Width="104"
- Height="64"
- BorderBrush="#A0A2AE"
- BorderThickness="1"
- CornerRadius="6">
- <Border.Background>
- <ImageBrush ImageSource="{Binding FilePath, Converter={StaticResource FileToImageSourceConvert}}" />
- </Border.Background>
- </Border>
- <Label
- Name="LbPageNum"
- Width="auto"
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- Background="Transparent"
- Content="{Binding Name}"
- FontSize="12" />
- </StackPanel>
- <DataTemplate.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
- <Setter TargetName="BdBorder" Property="BorderBrush" Value="#118AFF" />
- <Setter TargetName="BdBorder" Property="CornerRadius" Value="4" />
- <Setter TargetName="LbPageNum" Property="Foreground" Value="#118AFF" />
- </DataTrigger>
- </DataTemplate.Triggers>
- </DataTemplate>
- </ResourceDictionary>
- </UserControl.Resources>
- <cus:DialogContent Header="插入自定义页面">
- <cus:DialogContent.Content>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition />
- <RowDefinition Height="auto" />
- <RowDefinition Height="auto" />
- </Grid.RowDefinitions>
- <ListBox
- Padding="0,16,0,0"
- HorizontalAlignment="Center"
- BorderThickness="0"
- ItemTemplate="{StaticResource CustomItem}"
- ItemsSource="{Binding Pages}"
- SelectedIndex="{Binding ItemSelectedIndex, Mode=TwoWay}">
- <ListBox.ItemContainerStyle>
- <Style TargetType="{x:Type ListBoxItem}">
- <Setter Property="Template" Value="{StaticResource ListBoxItemControlTemplate}" />
- <Setter Property="FocusVisualStyle" Value="{x:Null}" />
- </Style>
- </ListBox.ItemContainerStyle>
- <ListBox.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel />
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
- </ListBox>
- <StackPanel Grid.Row="1" Margin="16,0">
- <TextBlock
- FontSize="14"
- FontWeight="SemiBold"
- Text="页面大小" />
- <StackPanel
- Margin="0,12,0,0"
- VerticalAlignment="Bottom"
- Orientation="Horizontal">
- <RadioButton
- Height="32"
- VerticalContentAlignment="Center"
- Content="当前页"
- GroupName="PageSize"
- IsChecked="{Binding IsCurrentSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
- <Label
- Height="32"
- Margin="8,0"
- HorizontalAlignment="Center"
- VerticalContentAlignment="Center"
- Content="{Binding CurrentPageSize}"
- FontSize="14" />
- </StackPanel>
- <StackPanel Margin="0,12" Orientation="Horizontal">
- <RadioButton
- Name="RbtnStandard"
- VerticalAlignment="Center"
- Content="标准"
- GroupName="PageSize"
- IsChecked="{Binding IsStandSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
- <ComboBox
- Width="228"
- Height="32"
- Margin="8,0"
- IsEnabled="{Binding ElementName=RbtnStandard, Path=IsChecked}"
- ItemsSource="{Binding PageSize}"
- SelectedIndex="{Binding PageSizeSelectedIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
- </StackPanel>
- <StackPanel Margin="0,0,0,12" Orientation="Horizontal">
- <RadioButton
- Name="RbtnCustom"
- VerticalAlignment="Center"
- Content="自定义"
- GroupName="PageSize"
- IsChecked="{Binding IsCustomSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
- <TextBox
- Width="80"
- Height="32"
- Margin="8,0"
- VerticalContentAlignment="Center"
- IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
- Text="{Binding CustomWidth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
- <TextBlock VerticalAlignment="Center" Text="X" />
- <TextBox
- Width="80"
- Height="32"
- Margin="8,0"
- VerticalContentAlignment="Center"
- IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
- Text="{Binding CustomHeight, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
- <ComboBox
- Width="80"
- VerticalContentAlignment="Center"
- IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
- ItemsSource="{Binding Units}"
- SelectedIndex="{Binding UnitsSelectedIndex}" />
- </StackPanel>
- </StackPanel>
- <StackPanel Grid.Row="2" Margin="16,0">
- <TextBlock
- FontSize="14"
- FontWeight="SemiBold"
- Text="方向" />
- <StackPanel Orientation="Horizontal">
- <RadioButton
- Margin="0,12,0,16"
- Content="纵向页面"
- IsChecked="{Binding IsVerticalSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
- <RadioButton
- Margin="24,12,0,16"
- Content="横向页面"
- IsChecked="{Binding IsHorizontalSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
- Tag="Vertical" />
- </StackPanel>
- </StackPanel>
- </Grid>
- </cus:DialogContent.Content>
- <cus:DialogContent.BottmBar>
- <Grid>
- <Button
- Width="98"
- Height="32"
- Margin="16,0"
- HorizontalAlignment="Right"
- Command="{Binding CancelCommand}"
- Content="取消" />
- <Button
- Width="98"
- Height="32"
- Margin="124,0"
- HorizontalAlignment="Right"
- Command="{Binding InsertCommnad}"
- Content="插入" />
- </Grid>
- </cus:DialogContent.BottmBar>
- </cus:DialogContent>
- </UserControl>
|