<Border x:Class="SparkClient.Views.Configuration.LevelConfigPage"
        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:SparkClient.Views"
        xmlns:hc="https://handyorg.github.io/handycontrol"
        mc:Ignorable="d">
    <Border.Resources>
        <Style x:Key="BorderRowStyle" TargetType="Border">
            <Setter Property="CornerRadius" Value="15" />
            <Setter Property="Background" Value="#ffffff" />
            <Setter Property="Padding" Value="5 10" />
            <Setter Property="Margin" Value="2 3" />
        </Style>
        <!-- 自定义 DataGrid 样式 -->
        <Style TargetType="DataGrid" x:Key="CustomDataGridStyle">
            <!-- 整体设置 -->
            <Setter Property="Background" Value="Transparent"/>       <!-- DataGrid 背景透明 -->
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="GridLinesVisibility" Value="None"/>     <!-- 去掉网格线 -->
            <Setter Property="IsReadOnly" Value="True"/>             <!-- 不可编辑 -->
            <Setter Property="ColumnWidth" Value="*"/>               <!-- 列铺满剩余空间 -->
            <Setter Property="HeadersVisibility" Value="Column"/>        <!-- 显示标题行 -->
            <Setter Property="AutoGenerateColumns" Value="False"/>    <!-- 根据需要,可开启或关闭 -->

            <Setter Property="RowStyle">
                <Setter.Value>
                    <Style TargetType="DataGridRow">
                        <!-- 行背景色, 包括选中、鼠标悬浮等情况下也都能看到基本色 -->
                        <!-- <Setter Property="Background" Value="#f0f1f6"/> -->
                        <Setter Property="Height" Value="50"/>
                        <!-- 行下方留 2 像素空隙,相当于“行间距” -->
                        <Setter Property="Margin" Value="0,3,0,3"/>

                        <!-- 如果你想去掉选中/悬浮的高亮色,可进一步设置 SelectionUnit、Triggers 等 -->
                    </Style>
                </Setter.Value>
            </Setter>

            <!-- 标题行样式 -->
            <Setter Property="ColumnHeaderStyle">
                <Setter.Value>
                    <Style TargetType="DataGridColumnHeader">
                        <!-- 标题背景色 -->
                        <Setter Property="Background" Value="#f0f1f6"/>
                        <!-- 标题内容居中 -->
                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                        <Setter Property="VerticalContentAlignment" Value="Center"/>
                        <Setter Property="Height" Value="50"/>
                        <!-- <Setter Property="ClipToBounds" Value="True"/> -->
                        <!-- 如果想去掉边框,可设置 BorderThickness、BorderBrush 等 -->
                    </Style>
                </Setter.Value>
            </Setter>

            <!-- 单元格样式:让单元格内容水平/垂直居中 -->
            <Setter Property="CellStyle">
                <Setter.Value>
                    <Style TargetType="DataGridCell">
                        <Setter Property="BorderThickness" Value="0"/>
                        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                        <Setter Property="VerticalContentAlignment" Value="Center"/>
                        <!-- 同样可以在此修改单元格的边框、前景色等 -->
                    </Style>
                </Setter.Value>
            </Setter>
        </Style>
    </Border.Resources>
    
    <Grid Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Border Grid.Row="0" Style="{DynamicResource BorderRowStyle}">
            <Grid Margin=" 0 10">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Border Grid.Column="0" Background="#e0e2ee" CornerRadius="20" Height="40" Width="210" Margin="10 0 0 0">
                    <ComboBox  Width="180" hc:DropDownElement.ConsistentWidth="False" SelectedIndex="0"
                              ItemsSource="{Binding Institutes}" Margin="10 0" DisplayMemberPath="{DynamicResource RULE_NAME}" SelectedValuePath="RULE_ID"
                              SelectedValue="{Binding InstituteId, Mode=TwoWay}" 
                              SelectionChanged="ChangeInstitutes"
                              IsEnabled="{Binding InstitutesEnabled,Mode=TwoWay}"
                              FontSize="16" Background="Transparent" BorderThickness="0" BorderBrush="Black"
                    >
                  
                    </ComboBox>
                </Border>
                
                <Border Grid.Column="1"  Background="#e0e2ee" CornerRadius="20" Height="40" Width="210" Margin="10 0 0 0">
                    <ComboBox Width="180" hc:DropDownElement.ConsistentWidth="False" SelectedIndex="0"
                              ItemsSource="{Binding Shapes}" Margin="10 0" DisplayMemberPath="{DynamicResource SHAPE_NAME}" SelectedValuePath="SHAPE_ID"
                              SelectedValue="{Binding ShapeId, Mode=TwoWay}" 
                              SelectionChanged="ChangeShapes"  FontSize="16" Background="Transparent" BorderThickness="0"
                              IsEnabled="{Binding ShapesEnabled,Mode=TwoWay}" BorderBrush="Black"/>
                </Border>
                <Button Grid.Column="2" Grid.Row="0" Width="100"  Margin="10 5 "  Padding="0"  Height="50" IsEnabled="{Binding IsUpdateButtonEnabled}"
                        BorderThickness="0" Background="Transparent" FocusVisualStyle="{x:Null}"  Command="{Binding SaveLevelConfigCommand}">
                    <Border HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Margin="0 0 0 0"
                            Padding="10, 10"
                            Width="100" 
                            BorderThickness="0"
                            CornerRadius="20">
                        <Border.Background>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <GradientStop Color="#29c4ba" Offset="0"/>
                                <GradientStop Color="#13b1a8" Offset="1"/>
                            </LinearGradientBrush>
                        </Border.Background>
                        <TextBlock  Text="{ DynamicResource Save}"  TextAlignment="Center" Foreground="#ffffff" FontSize="16"></TextBlock>
                    </Border>
                </Button>
                <!-- <Button Grid.Column="2" Content="{DynamicResource Save}" Margin="10 0" Command="{Binding SaveLevelConfigCommand}"/> -->
                <!--<Button Grid.Column="3" Content="{DynamicResource DeleteConfig}" Margin="10 0" Command="{Binding DelLevelConfigCommand}"/>-->
                <!-- <Button Grid.Column="5" Content="{DynamicResource ImportConfig}" Margin="10 0" HorizontalAlignment="Right" Command="{Binding LoadLevelConfigCommand}"/> -->
                <Button Grid.Column="5" Grid.Row="0" Width="100"  Margin="10 5 10 5"  Padding="0"  Height="50" 
                        BorderThickness="0" Background="Transparent" FocusVisualStyle="{x:Null}"  Command="{Binding LoadLevelConfigCommand}">
                    <Border HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Margin="0 0 0 0"
                            Padding="10, 10"
                            Width="100" 
                            BorderThickness="0"
                            CornerRadius="20">
                        <Border.Background>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <GradientStop Color="#36adff" Offset="0"/>
                                <GradientStop Color="#3c9ce6" Offset="1"/>
                            </LinearGradientBrush>
                        </Border.Background>
                        <TextBlock  Text="{ DynamicResource ImportConfig}"  TextAlignment="Center" Foreground="#ffffff" FontSize="16"></TextBlock>
                    </Border>
                </Button>
            </Grid>
        </Border>

        <Border Grid.Row="1" Style="{DynamicResource BorderRowStyle}">
            <!-- <DataGrid Grid.Row="1" x:Name="DataGrid1" HeadersVisibility="Column" RowHeaderWidth="60" AutoGenerateColumns="False" IsReadOnly="True" -->
            <!--           ItemsSource="{Binding StandardList}" CanUserResizeColumns="False" CanUserResizeRows="False"> -->
            <!--     <DataGrid.ColumnHeaderStyle> -->
            <!--         <Style TargetType="DataGridColumnHeader"> -->
            <!--             <Setter Property="MinWidth" Value="150"/> -->
            <!--             <Setter Property="BorderThickness" Value="1,1,1,1"/> -->
            <!--             <Setter Property="BorderBrush" Value="Gray"/> -->
            <!--             <Setter Property="HorizontalContentAlignment" Value="Center"/> -->
            <!--         </Style> -->
            <!--     </DataGrid.ColumnHeaderStyle> -->
            <!--     <DataGrid.CellStyle> -->
            <!--         <Style TargetType="DataGridCell"> -->
            <!--             <Setter Property="BorderThickness" Value="1,1,1,1"/> -->
            <!--             <Setter Property="BorderBrush" Value="Gray"/> -->
            <!--         </Style> -->
            <!--     </DataGrid.CellStyle> -->
            <!--     <DataGrid.RowStyle> -->
            <!--         <Style TargetType="DataGridRow"> -->
            <!--             <Setter Property="HorizontalContentAlignment" Value="Center"/> -->
            <!--         </Style> -->
            <!--     </DataGrid.RowStyle> -->
            <!-- </DataGrid> -->
            <DataGrid Style="{StaticResource CustomDataGridStyle}"
                      ItemsSource="{Binding StandardList}" x:Name="DataGrid1" CanUserSortColumns="False" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserReorderColumns="False">
                <!-- 自定义列示例(AutoGenerateColumns=false 时需要手动定义) -->
                <!-- <DataGrid.Columns> -->
                <!--     <DataGridTextColumn Header="列一" Binding="{Binding Prop1}" /> -->
                <!--     <DataGridTextColumn Header="列二" Binding="{Binding Prop2}" /> -->
                <!--     ~1~ ... @1@ -->
                <!-- </DataGrid.Columns> -->
            </DataGrid>
        </Border>
        
    </Grid>
</Border>