UsrPrintTemplatebottom.xaml 11.6 KB
<UserControl x:Class="SmartScan.SetControl.WPF.UsrPrintTemplatebottom"
             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:SmartScan.SetControl.WPF"
             mc:Ignorable="d" Loaded="UserControl_Loaded"
            Background="#1a1a1a">

    <UserControl.Resources>
        <!-- 通用样式 -->
        <Style x:Key="LabelStyle" TargetType="TextBlock">
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="FontFamily" Value="微软雅黑"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="Margin" Value="5,0"/>
        </Style>

        <!-- 标题样式 -->
        <Style x:Key="HeaderStyle" TargetType="TextBlock" BasedOn="{StaticResource LabelStyle}">
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="HorizontalAlignment" Value="Center"/>
          
        </Style>

        <!-- 蓝色边框样式 -->
        <Style x:Key="BlueBorderStyle" TargetType="Border">
            <Setter Property="BorderBrush" Value="#0078d7"/>
            <Setter Property="BorderThickness" Value="1"/>
        </Style>
        <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="20" />
                </Grid.ColumnDefinitions>
                <Border Grid.ColumnSpan="2" 
              Background="Transparent" 
              BorderBrush="#444444" 
              BorderThickness="1" />
                <Border Grid.Column="1" 
              Background="Transparent" 
              BorderBrush="#444444" 
              BorderThickness="0,0,0,0" />
            </Grid>
        </ControlTemplate>
        <!-- 按钮样式 -->
        <Style x:Key="ButtonStyle" TargetType="Button">
            <Setter Property="Background" Value="#1c1c1c"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="BorderBrush" Value="#0078d7"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Height" Value="40"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="Padding" Value="10,5"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}">
                            <ContentPresenter HorizontalAlignment="Center" 
                                            VerticalAlignment="Center"
                                            Margin="{TemplateBinding Padding}"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Background" Value="#0078d7"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter Property="Background" Value="#005a9e"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- 下拉框样式 -->
        <Style x:Key="ComboBoxStyle" TargetType="ComboBox">
            <Setter Property="Background" Value="#1c1c1c"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="BorderBrush" Value="#0078d7"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Height" Value="32"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
        </Style>

        <!-- 复选框样式 -->
        <Style x:Key="CheckBoxStyle" TargetType="CheckBox">
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Margin" Value="5"/>
            <Setter Property="FontSize" Value="14"/>
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
           
        </Grid.RowDefinitions>

        <!-- 标题栏 -->
        <Border Grid.Row="0" Style="{StaticResource BlueBorderStyle}" Background="#0078d7">
            <TextBlock Text="字段操作" Name="UsrPrintTemplate_facePanel7" Style="{StaticResource HeaderStyle}"  Padding="0,5"/>
        </Border>

        <!-- 字段类型和显示关键字选项 -->
        <Grid Grid.Row="1" Margin="0,10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <TextBlock Text="字段类型" Name="UsrPrintTemplate_LblFieldType" Grid.Column="0" Style="{StaticResource LabelStyle}" HorizontalAlignment="Left" Margin="5,0"/>
            <ComboBox x:Name="CboFieldType"  Foreground="White" Grid.Column="1" Margin="5,0,10,0">
                <ComboBox.Resources>
                    <!-- 下拉菜单背景色 -->
                    <SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="#222222"/>
                    <!-- 选中项背景色 -->
                    <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#444444"/>
                </ComboBox.Resources>

                <ComboBox.ItemContainerStyle>
                    <Style TargetType="{x:Type ComboBoxItem}">
                        <Setter Property="Background" Value="Transparent"/>
                        <Setter Property="Foreground" Value="White"/>
                        <Style.Triggers>
                            <Trigger Property="IsHighlighted" Value="True">
                                <Setter Property="Background" Value="#444444"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </ComboBox.ItemContainerStyle>

                <!-- 设置下拉箭头样式 -->
                <ComboBox.Style>
                    <Style TargetType="{x:Type ComboBox}">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ComboBox}">
                                    <Grid>
                                        <ToggleButton x:Name="ToggleButton" 
                                     ClickMode="Press" 
                                     Focusable="false"
                                     IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                     Template="{StaticResource ComboBoxToggleButton}"/>

                                        <ContentPresenter x:Name="ContentSite"
                                        IsHitTestVisible="False" 
                                        Content="{TemplateBinding SelectionBoxItem}"
                                        ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                                        ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                                        Margin="8,3,32,3"
                                        VerticalAlignment="Center"
                                        HorizontalAlignment="Left"/>

                                        <Path x:Name="Arrow"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Center"
                             Margin="0,0,8,0"
                             Fill="White"
                             Data="M 0 0 L 6 6 L 12 0 Z"/>

                                        <Popup x:Name="Popup"
                              Placement="Bottom"
                              IsOpen="{TemplateBinding IsDropDownOpen}"
                              AllowsTransparency="True" 
                              Focusable="False"
                              PopupAnimation="Slide">
                                            <Grid x:Name="DropDown"
                                 SnapsToDevicePixels="True"                
                                 MinWidth="{TemplateBinding ActualWidth}"
                                 MaxHeight="{TemplateBinding MaxDropDownHeight}">
                                                <Border x:Name="DropDownBorder"
                                      Background="#222222"
                                      BorderThickness="1"
                                      BorderBrush="#444444"/>
                                                <ScrollViewer SnapsToDevicePixels="True">
                                                    <ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained"/>
                                                </ScrollViewer>
                                            </Grid>
                                        </Popup>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ComboBox.Style>

            </ComboBox>

            <CheckBox x:Name="UsrPrintTemplate_ChkFieldShowKey" Content="显示关键字" Grid.Column="2" 
                      Style="{StaticResource CheckBoxStyle}" VerticalAlignment="Center" 
                    HorizontalAlignment="Center"/>
        </Grid>

        <!-- 操作按钮 - 第一行 -->
        <Grid Grid.Row="2" Margin="0,5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Button x:Name="UsrPrintTemplate_BtnAddField" Content="添加字段" Grid.Column="0" Style="{StaticResource ButtonStyle}" Margin="5"/>
            <Button x:Name="UsrPrintTemplate_BtnDelField" Content="删除字段" Grid.Column="1" Style="{StaticResource ButtonStyle}" Margin="5"/>
            <Button x:Name="UsrPrintTemplate_BtnFieldFont" Content="字段字体" Grid.Column="2" Style="{StaticResource ButtonStyle}" Margin="5"/>
            <Button x:Name="UsrPrintTemplate_BtnSetField" Content="设置字段内容" Grid.Column="3" Style="{StaticResource ButtonStyle}" Margin="5"/>
            <Button x:Name="UsrPrintTemplate_BtnPrintTest" Content="打印测试" Grid.Column="4" Style="{StaticResource ButtonStyle}"  />
        </Grid>

        <!-- 操作按钮 - 第二行 -->
        <Grid Grid.Row="3" Margin="0,5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

         
        </Grid>

        <!-- 底部的打印测试按钮 -->
     
    </Grid>
</UserControl>