<UserControl x:Class="SlnMesnac.WPF.Page.CabinetInfo.CabinetInfoControl"
             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:SlnMesnac.WPF.Page.CabinetInfo"
             xmlns:local1="clr-namespace:SlnMesnac.WPF.Converter.Sys_Flag"
             mc:Ignorable="d" 
            d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent">

    <UserControl.Resources>
        <local1:IsFlagConvert x:Key="IsFlagConvert"/>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="2*"/>
            <RowDefinition Height="14*"/>
        </Grid.RowDefinitions>
        <Border Grid.Row="0" BorderBrush="#FFFFFF" BorderThickness="2" CornerRadius="10" Background="#FFFFFF" Margin="10,10">
            <StackPanel Grid.Column="0" VerticalAlignment="Center"  HorizontalAlignment="Left" Orientation="Horizontal">
                <TextBlock Text="电柜编号" FontSize="18" Foreground="#31446E" Margin="10,3"/>
                <TextBox Text="{Binding CabinetCodeSearch}" FontSize="16" Grid.Row="1" Width="180" Height="30" VerticalContentAlignment="Center" HorizontalAlignment="Center" Padding="5">
                    <TextBox.Template>
                        <ControlTemplate TargetType="TextBox">
                            <Border Background="#EBF4FD" BorderBrush="White" BorderThickness="1" CornerRadius="5">
                                <ScrollViewer x:Name="PART_ContentHost" />
                            </Border>
                        </ControlTemplate>
                    </TextBox.Template>
                </TextBox>

                <TextBlock Text="电柜别名" FontSize="18" Foreground="#31446E" Margin="50,0,10,3"/>
                <TextBox Text="{Binding CabinetAliasSearch}" FontSize="16" Grid.Row="1" Width="180" Height="30" VerticalContentAlignment="Center" HorizontalAlignment="Center" Padding="5">
                    <TextBox.Template>
                        <ControlTemplate TargetType="TextBox">
                            <Border Background="#EBF4FD" BorderBrush="White" BorderThickness="1" CornerRadius="5">
                                <ScrollViewer x:Name="PART_ContentHost" />
                            </Border>
                        </ControlTemplate>
                    </TextBox.Template>
                </TextBox>

                <!--<TextBlock Text="是否巡检" FontSize="18" Foreground="#31446E" Margin="50,0,10,3"/>
                <TextBox Text="{Binding RfidCode}" FontSize="16" Grid.Row="1" Width="180" Height="30" VerticalContentAlignment="Center" HorizontalAlignment="Center" Padding="5">
                    <TextBox.Template>
                        <ControlTemplate TargetType="TextBox">
                            <Border Background="#EBF4FD" BorderBrush="White" BorderThickness="1" CornerRadius="5">
                                <ScrollViewer x:Name="PART_ContentHost" />
                            </Border>
                        </ControlTemplate>
                    </TextBox.Template>
                </TextBox>-->

                <Button Content="查    询" Command="{Binding QueryCabinetInfoCommand}" Style="{StaticResource  BUTTON_AGREE}"  Width="100" Height="30" Background="#5095F3" BorderBrush="#5095F3" Margin="30,0,10,0"/>
                <!--<Button Content="导    出" Command="{Binding ExportCabinetInfoCommand}" Style="{StaticResource  BUTTON_AGREE}"  Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>-->
            </StackPanel>
        </Border>

        <Border Grid.Row="1">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="2*"/>
                    <ColumnDefinition Width="6*"/>
                </Grid.ColumnDefinitions>
                <Border Grid.Column="0" BorderBrush="#FFFFFF" BorderThickness="2" CornerRadius="10" Background="#FFFFFF" Margin="10,10">
                    <DataGrid Grid.Row="0" ItemsSource="{Binding CabinetInfoItems}" Background="Transparent" 
                      FontSize="18" ColumnHeaderHeight="35" 
                      RowHeight="40" AutoGenerateColumns="False" RowHeaderWidth="0" 
                      GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden" 
                      ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" CanUserAddRows="False" HorizontalAlignment="Center"
                      Foreground="#31446E" x:Name="CabinetInfoItemsDataGrid" Margin="0,10,0,0" MouseDoubleClick="CabinetInfoItemsDataGrid_MouseDoubleClick" >
                        <!--resourceStyle 399行修改选中字体颜色-->
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding cabinetCode}" Header="电柜编号" Width="2*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding cabinetAlias}" Header="电柜别名" Width="2*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding isChecked,Converter={StaticResource IsFlagConvert}}"  Header="是否检测" Width="2*" IsReadOnly="True"/>
                            <!--<DataGridTextColumn Binding="{Binding isRotate,Converter={StaticResource IsFlagConvert}}"  Header="是否旋转" Width="2*" IsReadOnly="True"/>-->
                            <!--<DataGridTextColumn Binding="{Binding rotateAngle}"  Header="旋转角度" Width="2*" IsReadOnly="True"/>-->
                            <DataGridTemplateColumn Header="操作" Width="1.5*">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button Content="编辑" Command="{Binding DataContext.CabinetUpdateCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" CommandParameter="{Binding}"  Style="{StaticResource  BUTTON_AGREE}" FontSize="14" Width="80" Height="30" Background="#009999" BorderBrush="#FF36B5C1"  VerticalAlignment="Center" HorizontalAlignment="Center"/>

                                        <!--<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                                            <Button Content="编辑" Command="{Binding DataContext.OpenImageFileCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" CommandParameter="{Binding}"  Style="{StaticResource  BUTTON_AGREE}" FontSize="14" Width="80" Height="30" Background="#009999" BorderBrush="#FF36B5C1"  VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,5,0"/>
                                            <Button Content="母排信息" Command="{Binding DataContext.OpenImageFileCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" CommandParameter="{Binding}"  Style="{StaticResource  BUTTON_AGREE}" FontSize="14" Width="80" Height="30" Background="#009999" BorderBrush="#FF36B5C1"  VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0,0,0"/>
                                        </StackPanel>-->
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </Border>

                <Border Grid.Column="1" BorderBrush="#FFFFFF" BorderThickness="2" CornerRadius="10" Background="#FFFFFF" Margin="10,10">
                    <DataGrid Grid.Row="0" ItemsSource="{Binding BusbarInfoItems}" Background="Transparent" 
                      FontSize="18" ColumnHeaderHeight="35" 
                      RowHeight="40" AutoGenerateColumns="False" RowHeaderWidth="0" 
                      GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden" 
                      ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" CanUserAddRows="False" HorizontalAlignment="Center"
                      Foreground="#31446E" x:Name="dataGrid2" Margin="0,10,0,0" >
                        <!--resourceStyle 399行修改选中字体颜色-->
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding cabinetCode}" Header="电柜编号" Width="2*" IsReadOnly="True"/>
                            <!--<DataGridTextColumn Binding="{Binding busbarCode}" Header="母排编号" Width="2*" IsReadOnly="True"/>-->
                            <DataGridTextColumn Binding="{Binding busbarAlias}" Header="检测位置" Width="2*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding busbarDist}" Header="升降距离" Width="2*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding isRotate,Converter={StaticResource IsFlagConvert}}"  Header="是否旋转" Width="2*" IsReadOnly="True"/>


                            <DataGridTextColumn Binding="{Binding wPanPos}" Header="P" Width="2*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding wTiltPos}" Header="T" Width="2*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding wZoomPos}" Header="Z" Width="2*" IsReadOnly="True"/>

                            <!--<DataGridTextColumn Binding="{Binding isEnd,Converter={StaticResource IsFlagConvert}}" Header="是否尾排" Width="2*" IsReadOnly="True"/>-->
                            <DataGridTextColumn Binding="{Binding isChecked,Converter={StaticResource IsFlagConvert}}" Header="是否检测" Width="2*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding isPictures,Converter={StaticResource IsFlagConvert}}" Header="是否拍照" Width="2*" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding isInsp,Converter={StaticResource IsFlagConvert}}" Header="是否快检" Width="2*" IsReadOnly="True"/>
                            <DataGridTemplateColumn Header="操作" Width="1.5*">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button Content="编辑" Command="{Binding DataContext.BusbarUpdateCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" CommandParameter="{Binding}"  Style="{StaticResource  BUTTON_AGREE}" FontSize="14" Width="80" Height="30" Background="#009999" BorderBrush="#FF36B5C1"  VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </Border>
            </Grid>
        </Border>
        
        
    </Grid>
</UserControl>
