schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<UserControl x:Class="XHandler.View.BacteriaProperty.SubMethodProperty"
             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:XHandler.View.BacteriaProperty"
             xmlns:str="clr-namespace:XHandler.Properties"
             xmlns:ctrls="clr-namespace:XHandler.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800" Loaded="UserControl_Loaded">
    <ScrollViewer x:Name="scrollViewer">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="40"/>
                <RowDefinition Height="40"/>
                <RowDefinition Height="40"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="40"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="130"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
 
            <!--命令标签-->
            <TextBlock Grid.Row="0" Grid.Column="0" Text="{x:Static str:Resources.strCommandTag}" FontSize="16"
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 0 15 0"/>
            <TextBox Grid.Row="0" Grid.Column="1"  x:Name="tbxCommandLabel" Height="30" FontSize="16" VerticalContentAlignment="Center" BorderThickness="0" Background="{DynamicResource lightGrayBrush}"
                 Text="{Binding label, Mode=TwoWay}" TextChanged="tbxCommandLabel_TextChanged" IsEnabled="False"/>
 
            <!--命令名称-->
            <TextBlock Grid.Row="1" Grid.Column="0" Text="{x:Static str:Resources.strCommandName}" FontSize="16" 
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 0 15 0"/>
            <TextBox x:Name="tbxCommandName" Grid.Row="1" Grid.Column="1" Height="30" FontSize="16" VerticalContentAlignment="Center" Background="{DynamicResource lightGrayBrush}"
                     BorderThickness="0" TextChanged="tbxCommandName_TextChanged" >
                <TextBox.Text>
                    <Binding Path="name" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True" >
                        <Binding.ValidationRules>
                            <local:BacteriaPropertyValidationRule  ValidateType="1,6@[100]"/>
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <TextBlock Grid.Row="1" Grid.Column="2" x:Name="nError" Text="{Binding  ElementName=tbxCommandName,Path=(Validation.Errors)[0].ErrorContent}" Foreground="Red" FontSize="16" 
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 5 5 0"/>
            <TextBlock Grid.Row="2" Grid.Column="0" Text="{x:Static str:Resources.strComment}" FontSize="16" 
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 0 15 0"/>
            <TextBox Grid.Row="2" Grid.Column="1" x:Name="tbxCommandComment" Height="30" FontSize="16" VerticalContentAlignment="Center" BorderThickness="0" Background="{DynamicResource lightGrayBrush}"
                 Text="{Binding comment}" TextChanged="tbxCommandComment_TextChanged"/>
 
            <!--文件-->
            <TextBlock Grid.Row="3" Grid.Column="0" Text="文件" FontSize="16" 
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 0 15 0"/>
            <TextBox Grid.Row="3" Grid.Column="1" x:Name="tboxFile" FontSize="16" VerticalContentAlignment="Top" VerticalScrollBarVisibility="Auto" BorderThickness="0" Background="{DynamicResource lightGrayBrush}"
                 Margin="0 5 0 10" AcceptsReturn="True" TextWrapping="Wrap" Text="{Binding filePath, Mode=TwoWay}" TextChanged="tboxFile_TextChanged"/>
 
            <ctrls:ImageButton Grid.Row="3" Grid.Column="2" x:Name="btnSelectFile" NormalImage="pack://application:,,,./Assets/CmdSet/文件.png" Width="40" Height="30"
                               ImageWidth="32" ImageHeight="32" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10 0 0 0"
                               Click="btnSelectFile_Click"/>
            <TextBlock Grid.Row="4" Grid.Column="0" Text="{x:Static str:Resources.strConcurrence}" FontSize="16"
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 0 15 0"/>
            <CheckBox x:Name="cbxIsConcurrence" Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="16" Margin="20 0" IsChecked="{Binding isConcurrence, Mode=TwoWay}" Style="{DynamicResource SwitchCheckBoxStyle}" Click="cbxIsConcurrence_Click"/>
        </Grid>
    </ScrollViewer>
</UserControl>