<Window x:Class="Base_2_Window.MainWindow"
        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"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="2*" />
            <ColumnDefinition Width="5*" />
        </Grid.ColumnDefinitions>

        <StackPanel Grid.Column="0" Width="200" Margin="5">
            <StackPanel Orientation="Horizontal" Margin="0,0,0,5">
                <Label Width="60" VerticalAlignment="Center">串口:</Label>
                <ComboBox Width="100" Height="28" ItemsSource="{Binding SerialPortModel.SerialPortNames}" SelectedIndex="0" />
            </StackPanel>

            <StackPanel Orientation="Horizontal" Margin="0,0,0,5">
                <Label Width="60" VerticalAlignment="Center">波特率:</Label>
                <ComboBox Width="100" Height="28" ItemsSource="{Binding SerialPortModel.BaudRates}" SelectedIndex="0" />
            </StackPanel>

            <StackPanel Orientation="Horizontal" Margin="0,0,0,5">
                <Label Width="60" VerticalAlignment="Center">数据位:</Label>
                <ComboBox Width="100" Height="28" ItemsSource="{Binding SerialPortModel.DataBits}" SelectedIndex="0" />
            </StackPanel>

            <StackPanel Orientation="Horizontal" Margin="0,0,0,5">
                <Label Width="60" VerticalAlignment="Center">校验位:</Label>
                <ComboBox Width="100" Height="28" ItemsSource="{Binding SerialPortModel.ParityList}" SelectedIndex="0" />
            </StackPanel>

            <StackPanel Orientation="Horizontal" Margin="0,0,0,10">
                <Label Width="60" VerticalAlignment="Center">停止位:</Label>
                <ComboBox Width="100" Height="28" ItemsSource="{Binding SerialPortModel.StopBitsList}" SelectedIndex="0" />
            </StackPanel>

            <Button Height="32" Margin="0,5,0,0" FontWeight="Bold" Command="{Binding }">打开串口</Button>
        </StackPanel>

        <!-- 右侧通信面板 -->
        <Grid Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <!-- 消息显示区域 -->
            <GroupBox Grid.Row="0" Header="消息显示" Margin="0,0,0,5">
                <TextBox Name="MessageBox"
                         AcceptsReturn="True"
                         IsReadOnly="True"
                         VerticalScrollBarVisibility="Auto"
                         FontFamily="Consolas" />
            </GroupBox>

            <!-- 消息发送区域 -->
            <GroupBox Grid.Row="1" Header="发送消息">
                <DockPanel>
                    <Button DockPanel.Dock="Right"
                            Width="80"
                            Margin="5,0,0,0"
                            FontWeight="Bold">
                        发送
                    </Button>
                    <TextBox AcceptsReturn="True" VerticalScrollBarVisibility="Auto" />
                </DockPanel>
            </GroupBox>
        </Grid>
    </Grid>
</Window>