NS_Keyword.xaml 15.4 KB
<UserControl x:Class="SmartScan.SetControl.WPF.NS_Keyword"
             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" xmlns:local1="clr-namespace:SmartScan.SetControl.WPF.Convent"
             mc:Ignorable="d" 
             d:DesignHeight="850" d:DesignWidth="800"    Loaded="UserControl_Loaded" >
    
    <UserControl.Resources>
        <Style x:Key="TextBoxStyle1" TargetType="{x:Type TextBox}">

            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="AllowDrop" Value="true"/>
            <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
            <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>

            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TextBox}">
                        <Border CornerRadius="3" x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                            <ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
                        </Border>
                       
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <MultiTrigger>
                    <MultiTrigger.Conditions>
                        <Condition Property="IsInactiveSelectionHighlightEnabled" Value="true"/>
                        <Condition Property="IsSelectionActive" Value="false"/>
                    </MultiTrigger.Conditions>
                    <Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/>
                </MultiTrigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="AlternatingListBoxItemStyle" TargetType="ListBoxItem">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <Border Name="Bd" 
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Background="{TemplateBinding Background}"
                        Padding="{TemplateBinding Padding}">
                            
                            <ContentPresenter/>
                           
                        </Border>
                        <ControlTemplate.Triggers>
                             <!-- 鼠标悬停效果 -->
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="Bd" 
                                  Property="Background" 
                                  Value="#1AFFFFFF"/>
                                <!-- 10%透明度的白色 -->
                            </Trigger>
                            <!-- 选中状态触发器 -->
                            <Trigger Property="IsSelected" Value="True">
                                <Setter TargetName="Bd" Property="Background" Value="#4b78d0"/>
                                <Setter TargetName="Bd" Property="BorderBrush" Value="#FF3C8D3C"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
            <Setter Property="Foreground" Value="White"></Setter>
            <Setter Property="Padding" Value="5"/>
            <Setter Property="Height" Value="50"/>
            <!-- 关键行高设置 -->
            <Style.Triggers>
                <!--<Trigger Property="ItemsControl.AlternationIndex" Value="0">
                    <Setter Property="Background" Value="{x:Null}"/>
                    <Setter Property="Foreground" Value="White"/>
                    <Setter Property="IsSelected" Value="True"/>
                </Trigger>
                <Trigger Property="ItemsControl.AlternationIndex" Value="1">
                    <Setter Property="Background" Value="#FFB3B0B0"/>
                    <Setter Property="Foreground" Value="White"/>
                </Trigger>-->
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Background" Value="#4b78d0"/>
                    <!-- 深翡翠绿 -->
                    <Setter Property="BorderBrush" Value="#FF3C8D3C"/>

                </Trigger>
            </Style.Triggers>
        </Style>
        <local1:BoolToColorConverter x:Key="BoolToColor" TrueColor="Red" FalseColor="Gray"/>
        <Style x:Key="buttonStyle" TargetType="{x:Type Button}">

            <Setter Property="BorderThickness" Value="0" />

            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border CornerRadius="5" x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                            <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsDefaulted" Value="true">
                                <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="true">
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Background" TargetName="border" Value="#D2FFBB" />
                                <Setter Property="BorderBrush" TargetName="border" Value="#D2FFBB" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="#C6FFCC"/>
                    <Setter Property="Foreground" Value="Black"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>
    
    <Grid>
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.3*"></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Rectangle Fill="#C1C1C1" Width="0.3"   Grid.ColumnSpan="1" HorizontalAlignment="Right"/>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"></RowDefinition>
                <RowDefinition Height="1.7*"></RowDefinition>
                <RowDefinition></RowDefinition>
                
            </Grid.RowDefinitions>
            <Grid>
                <TextBlock Text="标准字段" HorizontalAlignment="Left" Foreground="White" FontFamily="微软雅黑" VerticalAlignment="Center" Margin="20 5 0 5" FontWeight="Bold" FontSize="25"></TextBlock>
                <Rectangle Fill="#C1C1C1" Height="0.3" Margin="0 5 0 0"   VerticalAlignment="Bottom"/>

            </Grid>
            <Grid Grid.Row="1">
              
                <ListBox ItemsSource="{Binding keyCopy}" Name="LstKey" Margin="5"
                 AlternationCount="2" Background="{x:Null}" BorderThickness="0"
                 ItemContainerStyle="{StaticResource AlternatingListBoxItemStyle}" SelectionChanged="LstKey_SelectionChanged">
                   
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                           
                                <Grid HorizontalAlignment="Stretch">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="auto"/>
                                    </Grid.ColumnDefinitions>
                              
                                <TextBlock Text="{Binding}" FontSize="16" VerticalAlignment="Center"  HorizontalAlignment="Left" Margin="5 0 0 0"/>
                                <Ellipse Grid.Column="1" Width="12" Height="12"   VerticalAlignment="Center" HorizontalAlignment="Right" >
                                    <Ellipse.Style>
                                        <Style TargetType="Ellipse">
                                            <Setter Property="Fill" Value="LightGray"/>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding 
                                    RelativeSource={RelativeSource 
                                    AncestorType={x:Type ListBoxItem}}, 
                                    Path=IsSelected}" 
                                    Value="True">
                                                    <Setter Property="Fill" Value="Aqua"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Ellipse.Style>
                                </Ellipse>
                                 </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
                <!--<Ellipse Width="12" Height="12" Margin="0,5,0,0"
                     Fill="{Binding SelectedItem.a, ElementName=LstKey, 
                                    Converter={StaticResource BoolToColor}}"/>-->
            </Grid>
            <Grid Grid.Row="2">
              
            </Grid>
        </Grid>
        <Grid Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="0.1*"></RowDefinition>
                <RowDefinition Height="0.2*"></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition  Height="0.3*"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Text="配置" FontSize="23" Foreground="#4975cd" FontFamily="微软雅黑" VerticalAlignment="Center" Margin="10 0 0 0" FontWeight="Bold"></TextBlock>
                <Button  Content="启动"  Grid.Column="1" Foreground="White"  Style="{DynamicResource buttonStyle}"   Height="30" Margin="15,0,10,0" Width="90" FontSize="15" HorizontalAlignment="Right" VerticalAlignment="Center" Background="#4b78d0" BorderThickness="1" Name="expand"  ></Button>
                <TextBlock Background="#C1C1C1" Margin="0,13,0,0" Height="0.3" Grid.ColumnSpan="2" VerticalAlignment="Bottom"> </TextBlock>
            </Grid>
            <Grid Grid.Row="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="0.3*"></RowDefinition>
                    <RowDefinition Height="0.5*"></RowDefinition>
                    <RowDefinition Height="0.2*"></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition ></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Text="字段标识符" Foreground="#696969" FontFamily="微软雅黑" VerticalAlignment="Center" Margin="10 0 0 0"  FontSize="18"></TextBlock>

                <TextBox x:Name="lst_key" Foreground="White" Background="#252525"  Grid.Row="1" Style="{StaticResource TextBoxStyle1}"  BorderThickness="1" CaretBrush="White" Margin="10 5 10 5" FontSize="25" FontFamily="微软雅黑" VerticalContentAlignment="Center" Text="" ></TextBox>
                <TextBlock Text="API和数据库中使用的唯一标识符" FontFamily="微软雅黑" Grid.Row="2" Foreground="#707070" VerticalAlignment="Center" Margin="10 0 0 0"  FontSize="16"></TextBlock>
                <TextBlock Text="显示名称:" Foreground="#696969"  FontFamily="微软雅黑" VerticalAlignment="Center" Grid.Column="1" Margin="10 0 0 0"  FontSize="18"></TextBlock>
                <TextBox x:Name="lst_name" Foreground="White" Background="#252525" Grid.Row="1" Grid.Column="1" Style="{StaticResource TextBoxStyle1}"  BorderThickness="1" CaretBrush="White" Margin="10 5 10 5" FontSize="25" VerticalContentAlignment="Center" Text="" ></TextBox>
                <TextBlock Text="在界面中显示的名称" Grid.Row="2" FontFamily="微软雅黑" Grid.Column="1"  Foreground="#707070" VerticalAlignment="Center" Margin="10 0 0 0"  FontSize="16"></TextBlock>
            </Grid>
            <Grid Grid.Row="3">
                <TextBlock Background="#C1C1C1" Margin="0,13,0,0" Height="0.3" Grid.ColumnSpan="2"></TextBlock>
                <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0 0 10 10">
                    <Button Content="添加"  Foreground="White" Style="{DynamicResource buttonStyle}" FontFamily="微软雅黑" Name="BtnAddKey" Height="30"  Width="90" Margin="5" Background="#4B78D0" Click="BtnAddKey_Click"></Button>
                    <Button Content="删除"  Foreground="White" Style="{DynamicResource buttonStyle}" FontFamily="微软雅黑" Name="BtnDelKey" Height="30" Width="90" Margin="5" Background="#4B78D0" Click="BtnDelKey_Click"></Button>
                    <Button Content="更新"  Foreground="White" Style="{DynamicResource buttonStyle}" FontFamily="微软雅黑" Name="BtnUpdateKey" Height="30" Width="90" Margin="5" Background="#4B78D0" Click="BtnUpdateKey_Click"></Button>
                    <Button Content="添加到生成条件" Style="{DynamicResource buttonStyle}" FontFamily="微软雅黑" Foreground="White" Name="BtnAppendKey"  Width="90" Height="30" Margin="5" Background="#4B78D0"></Button>
                    <Button Content="切换自动RI" Style="{DynamicResource buttonStyle}"  FontFamily="微软雅黑" Foreground="White" Name="btn_setriid" Width="90" Height="30" Margin="5" Background="#4B78D0"></Button>
                </StackPanel>
            </Grid>
        </Grid>
    </Grid>
</UserControl>