<UserControl x:Class="MainShell.Resources.CustomControl.RegionEditorView"
             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:MainShell.Resources.CustomControl"
             xmlns:mw="http://www.maxwell-gp.com/"
             x:Name="Root"
             mc:Ignorable="d" 
             d:DesignHeight="150" d:DesignWidth="550">
    <GroupBox Header="{Binding Title, ElementName=Root}" BorderBrush="#DDD" Margin="5">
        <Grid Margin="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="20"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="10"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal">
                <TextBlock Text="起始" VerticalAlignment="Center" FontWeight="Bold" Foreground="#4A90E2"/>
            </StackPanel>

            <UniformGrid Grid.Row="0" Grid.Column="1" Columns="2">
                <StackPanel Margin="2,0">
                    <TextBlock Text="行 (R)" FontSize="10" Foreground="Gray"/>
                    <mw:IntNumberBox mw:NumericKeypadAttach.IsEnabled="True" Value="{Binding StartRow, UpdateSourceTrigger=PropertyChanged}" Padding="3"/>
                </StackPanel>
                <StackPanel Margin="2,0">
                    <TextBlock Text="列 (C)" FontSize="10" Foreground="Gray"/>
                    <mw:IntNumberBox mw:NumericKeypadAttach.IsEnabled="True" Value="{Binding StartCol, UpdateSourceTrigger=PropertyChanged}" Padding="3"/>
                </StackPanel>
            </UniformGrid>

            <TextBlock Grid.Row="0" Grid.Column="2" Text="至" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,5"/>

            <StackPanel Grid.Row="0" Grid.Column="3" Orientation="Horizontal">
                <TextBlock Text="结束" VerticalAlignment="Center" FontWeight="Bold" Foreground="#E24A4A"/>
            </StackPanel>

            <UniformGrid Grid.Row="0" Grid.Column="4" Columns="2">
                <StackPanel Margin="2,0">
                    <TextBlock Text="行 (R)" FontSize="10" Foreground="Gray"/>
                    <mw:IntNumberBox mw:NumericKeypadAttach.IsEnabled="True" Value="{Binding EndRow, UpdateSourceTrigger=PropertyChanged}" Padding="3"/>
                </StackPanel>
                <StackPanel Margin="2,0">
                    <TextBlock Text="列 (C)" FontSize="10" Foreground="Gray"/>
                    <mw:IntNumberBox mw:NumericKeypadAttach.IsEnabled="True" Value="{Binding EndCol, UpdateSourceTrigger=PropertyChanged}" Padding="3"/>
                </StackPanel>
            </UniformGrid>

            <Border Visibility="Collapsed" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="5" Background="#F9F9F9" CornerRadius="4" Padding="8">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                    <TextBlock Text="当前选区规模：" Foreground="#666"/>
                    <TextBlock Text="{Binding RowCount}" FontWeight="Bold"/>
                    <TextBlock Text=" 行 × "/>
                    <TextBlock Text="{Binding ColCount}" FontWeight="Bold"/>
                    <TextBlock Text=" 列"/>
                    <TextBlock Text="{Binding TotalItems, StringFormat=' (共 {0} 点)'}" Margin="10,0,0,0" FontStyle="Italic"/>
                </StackPanel>
            </Border>
        </Grid>
    </GroupBox>
</UserControl>
