<Window x:Class="Aucma.Core.PrintTo.Views.SpecialPrintView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d" Background="#0C4CA3"    FontFamily="Microsoft YaHei"
        Title="特殊条码打印" Height="450" Width="800" WindowState="Normal" WindowStyle="ToolWindow"
         Name="window"
        >

    <Window.Resources>
        <Style TargetType="{x:Type Slider}">
            <Style.Resources>
                <!-- 重写重复触发按钮的样式 -->
                <Style x:Key="RepeatButtonStyle" TargetType="{x:Type RepeatButton}">
                    <Setter Property="Focusable" Value="false" />
                    <Setter Property="IsTabStop" Value="false" />
                    <Setter Property="Padding" Value="0" />
                    <Setter Property="Width" Value="30" />
                </Style>
            </Style.Resources>
            <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
            <Setter Property="SmallChange" Value="1" />
            <!-- 重写Slider的模板 -->
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Slider}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <TextBox Grid.RowSpan="2" Height="Auto"                                 
                                     Margin="0" Padding="0"          BorderBrush="White"                       
                                     VerticalAlignment="Stretch" VerticalContentAlignment="Center"                                 
                                     Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Value}">
                                <!-- 给TextBox绑定上下命令 -->
                                <TextBox.InputBindings>
                                    <KeyBinding Gesture="Up" Command="{x:Static Slider.IncreaseSmall}" />
                                    <KeyBinding Gesture="Down" Command="{x:Static Slider.DecreaseSmall}" />
                                    <KeyBinding Gesture="PageUp" Command="{x:Static Slider.IncreaseLarge}" />
                                    <KeyBinding Gesture="PageDown" Command="{x:Static Slider.DecreaseLarge}" />
                                </TextBox.InputBindings>
                            </TextBox>
                            <RepeatButton Grid.Row="0" Grid.Column="1"  Command="{x:Static Slider.IncreaseSmall}"                                     
                                          Style="{StaticResource RepeatButtonStyle}">
                                <Path Data="M4,0 L0,4 8,4 Z" Fill="Black" />
                            </RepeatButton>
                            <RepeatButton Grid.Row="1" Grid.Column="1" Command="{x:Static Slider.DecreaseSmall}"                                     
                                          Style="{StaticResource RepeatButtonStyle}">
                                <Path Data="M0,0 L4,4 8,0 Z" Fill="Black" />
                            </RepeatButton>
                            <!-- 由于Slider的内部实现要求存在这些必要组件,所以必须保留,但是设置为隐藏即可 -->
                            <Border x:Name="TrackBackground" Visibility="Collapsed">
                                <Rectangle x:Name="PART_SelectionRange" Visibility="Collapsed" />
                            </Border>
                            <Thumb x:Name="Thumb" Visibility="Collapsed" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>

    <Border Grid.Row="0" Grid.Column="0" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="1*"/>
                <RowDefinition Height="9*"/>
            </Grid.RowDefinitions>
            <Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0,0,0,1" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
                <TextBlock Text="特殊打印" FontSize="18" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
            </Border>

            <Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="0.5*"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <UniformGrid Grid.Row="0">
                        <GroupBox Margin="16 0" Header="条码类型" >
                            <WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center"   Margin="50 5" >
                                <RadioButton   Content="放行码" Foreground="White" FontSize="18" IsChecked="True"   Margin="10 0" />
                                <TextBox Text="{Binding BarCode,Mode=TwoWay}" PreviewMouseDoubleClick="TextBox_PreviewMouseDown"  FontSize="18" Width="300" BorderBrush="White" Foreground="White" Margin="10 0 0 0" HorizontalAlignment="Center" VerticalAlignment="Center" />
                            </WrapPanel>
                        </GroupBox>
                    </UniformGrid>
                    <UniformGrid Grid.Row="1">
                        <Border Margin="16 5" BorderBrush="#0288d1" BorderThickness="1"  CornerRadius="5"  >
                            <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
                                <WrapPanel Margin="5 0">
                                    <TextBlock   Text="打印数量" Foreground="white"  Margin="10 5" FontSize="18" />
                                    <Slider  x:Name="PrintAmount"  Minimum="0" Value="{Binding PrintNum,Mode=TwoWay}"  Maximum="500"  BorderBrush="White"  Foreground="White" Height="40" VerticalContentAlignment="Center"  HorizontalContentAlignment="Left"  VerticalAlignment="Center" HorizontalAlignment="Center"  Margin="15 0 0 0"   FontSize="18"   Width="300"/>
                                </WrapPanel>
                                <WrapPanel Margin="20" HorizontalAlignment="Center">
                                    <Button Content="打印" Background="#4285DE" Margin="30 0 0 0" FontSize="18"
                                          Height="40" Width="100"  Command="{Binding PrintCommand}"  />
                                    <Button Content="关闭" Background="#4285DE" Margin="20 0" FontSize="18"
                                         Height="40"  Width="100"  Command="{Binding CloseCommand}"  CommandParameter="{Binding   ElementName=window}"/>
                                </WrapPanel>
                            </StackPanel>
                        </Border>
                    </UniformGrid>
                </Grid>
            </Border>
        </Grid>
    </Border>

</Window>