<UserControl x:Class="CANModule.Views.CollectCANSignalSettingView"
                        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:CANModule.Views"
             xmlns:oxy="http://oxyplot.org/wpf"
             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             mc:Ignorable="d"
             xmlns:prism="http://prismlibrary.com/"
             xmlns:cons="clr-namespace:UIShare.Converters;assembly=UIShare"
             Background="White"
             prism:ViewModelLocator.AutoWireViewModel="True"
             Height="400"
             Width="1000">
    <prism:Dialog.WindowStyle>
        <Style BasedOn="{StaticResource DialogUserManageStyle}"
               TargetType="Window" />
    </prism:Dialog.WindowStyle>
    <UserControl.Resources>
        <cons:HexConverter x:Key="HexConverter" />
    </UserControl.Resources>
    <GroupBox Padding="0,0,0,0"
              MouseLeftButtonDown="MouseLeftButtonDown">
        <GroupBox.Header>
            <Grid  Margin="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <TextBlock Text="CAN信号采集设置"
                           Foreground="White"
                           VerticalAlignment="Center"
                           Margin="5,0,10,0" />
                <Button Content="关闭"
                        Grid.Column="2"
                        Margin="150 0 0 0"
                        Width="60"
                        Command="{Binding CloseCommand}"
                        Height="25" />
            </Grid>
        </GroupBox.Header>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>
            <DataGrid x:Name="配置表格"
                      AutoGenerateColumns="False"
                      ItemsSource="{Binding ConfigurationList}"
                      SelectedItem="{Binding SelectedItem}"
                      IsReadOnly="True">
                <DataGrid.ContextMenu>
                    <ContextMenu>
                        <MenuItem Header="删除"
                                  Command="{Binding DeleteCommand}"
                                 />
                    </ContextMenu>
                </DataGrid.ContextMenu>
                <DataGrid.Columns>
                    <DataGridTextColumn Header="通道"
                                        Binding="{Binding Channel}" />
                    <DataGridTextColumn Header="报文ID"
                                        Binding="{Binding MessageID,Converter={StaticResource HexConverter}}" />
                    <DataGridTextColumn Header="报文名称"
                                        Binding="{Binding MessageName}" />
                    <DataGridTextColumn Header="信号名称"
                                        Binding="{Binding SignalName}" />
                    <DataGridTextColumn Header="采集间隔"
                                        Binding="{Binding CollectionInterval}" />
                    <DataGridTextColumn Header="采集id"
                                        Binding="{Binding CollectionID}" />
                </DataGrid.Columns>
            </DataGrid>
            <StackPanel Orientation="Horizontal"
                        Grid.Row="1"
                        Margin="10">
                <Label Content="通道(从0开始)"
                       VerticalAlignment="Center" />
                <TextBox Name="SignalComboBox"
                          Text="{Binding MessageChannel}"
                          MaxWidth="200"
                          MinWidth="120"
                          Margin="10"
                          VerticalAlignment="Center"
                          materialDesign:HintAssist.Hint="信号通道" />
                <Label Content="报文"
                       VerticalAlignment="Center" />
                <ComboBox  MinWidth="100"
                           materialDesign:HintAssist.Hint=""
                           SelectedItem="{Binding SelectedMessage,Mode=TwoWay}"
                           ItemsSource="{Binding MessageList}"
                          />
                <Label Content="信号"
                       VerticalAlignment="Center" />
                <ComboBox SelectedItem="{Binding SelectedSignal}"
                          materialDesign:HintAssist.Hint=""
                          MaxWidth="200"
                          ItemsSource="{Binding SignalList,Mode=TwoWay}"
                          MinWidth="100" />
                <Label Content="采集间隔(ms)"
                       VerticalAlignment="Center" />
                <TextBox Text="{Binding CollectionInterval}"
                         MinWidth="100"
                         materialDesign:HintAssist.Hint=""
                         VerticalAlignment="Center" />
                <Button Content="添加"
                        Margin="10"
                        Command="{Binding AddCommand}"
                      />
                <Button Content="保存"
                        Margin="10"
                        Command="{Binding SaveCommand}"
                      />
            </StackPanel>
        </Grid>
    </GroupBox>
</UserControl>
