<mah:MetroWindow x:Class="BDU.Views.CANCatchSingalView"
        xmlns:metro="http://metro.mahapps.com/winfx/xaml/controls" 
        xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
        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"
        xmlns:local="clr-namespace:BDU.Views" xmlns:local1="clr-namespace:BDU.Converters"
                 mc:Ignorable="d"
        Title="CAN采集信号配置界面" Height="450" Width="1100">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        <DataGrid x:Name="配置表格" AutoGenerateColumns="False" ItemsSource="{Binding 配置}" IsReadOnly="True">
            <DataGrid.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="删除" Click="MenuItem_Click"/>
                </ContextMenu>
            </DataGrid.ContextMenu>
            <DataGrid.Columns>
                <DataGridTextColumn Header="通道" Binding="{Binding 通道}"/>
                <DataGridTextColumn Header="报文ID" Binding="{Binding 报文ID,Converter={StaticResource HexConverter}}"/>
                <DataGridTextColumn Header="报文名称" Binding="{Binding 报文名称}"/>
                <DataGridTextColumn Header="信号名称" Binding="{Binding 信号名称}"/>
                <DataGridTextColumn Header="采集间隔" Binding="{Binding 记录间隔}"/>
                <DataGridTextColumn Header="采集id" Binding="{Binding 采集id}"/>
            </DataGrid.Columns>
        </DataGrid>
        <StackPanel Orientation="Horizontal" Grid.Row="1" Margin="10">
            <Label Content="通道(从0开始)" VerticalAlignment="Center"/>
            <TextBox Text="{Binding 通道}" TextChanged="TextBox_TextChanged" MinWidth="100" VerticalAlignment="Center"/>
            <Label Content="报文" VerticalAlignment="Center"/>
            <ComboBox  MinWidth="100" SelectedIndex="{Binding 选中报文}" ItemsSource="{Binding 报文}" SelectionChanged="ComboBox_SelectionChanged"  />
            <Label Content="信号" VerticalAlignment="Center"/>
            <ComboBox SelectedIndex="{Binding 选中信号}" ItemsSource="{Binding 信号}"  MinWidth="100" />
            <Label Content="采集间隔(ms)" VerticalAlignment="Center"/>
            <TextBox Text="{Binding 采集间隔}"  MinWidth="100" VerticalAlignment="Center"/>
            <Button Content="添加" Margin="10" Click="Button_Click"/>
        </StackPanel>
    </Grid>
</mah:MetroWindow>
