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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<UserControl x:Class="XHandler.View.Consumables.BaseInfo"
             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.Consumables"
             xmlns:str="clr-namespace:XHandler.Properties"
             xmlns:ctrls="clr-namespace:XHandler.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">
    <Grid IsEnabled="{Binding is_default_type, Converter={StaticResource intToEnableConvert}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="40"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="40"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="40"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="0.6*"/>
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Row="0" Grid.Column="0" Text="{x:Static str:Resources.strBaseInfo}" VerticalAlignment="Center" Margin="20 0 0 0"
                   FontSize="20" FontWeight="Black"/>
        
        <TextBlock Grid.Row="1" Grid.Column="0" Text="{x:Static str:Resources.strName}" VerticalAlignment="Bottom" Margin="20 0 0 0"
                   FontSize="16"/>
        <!--<TextBox Grid.Row="2" Grid.Column="0" Height="30" FontSize="16" VerticalContentAlignment="Center" Margin="20 0 0 0" Background="{DynamicResource lightGrayBrush}"
                 BorderThickness="0" Text="{Binding labware_name, Mode=TwoWay}"/>-->
        <TextBox x:Name="txtlabware_name" Grid.Row="2" Grid.Column="0" Height="30" FontSize="16" VerticalContentAlignment="Center" VerticalAlignment="Top" Background="{DynamicResource lightGrayBrush}" Margin="20 0"
                     BorderThickness="0" >
            <TextBox.Text>
                <Binding Path="labware_name" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True" >
                    <Binding.ValidationRules>
                        <local:ConsumablesValidationRule  ValidateType="1,6@[256]"/>
                    </Binding.ValidationRules>
                </Binding>
            </TextBox.Text>
        </TextBox>
        <TextBlock Grid.Row="1" Grid.Column="0" x:Name="lnError" Text="{Binding  ElementName=txtlabware_name,Path=(Validation.Errors)[0].ErrorContent}" Foreground="Red" FontSize="16" 
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 5 5 0"/>
 
        <TextBlock Grid.Row="1" Grid.Column="1" Text="{x:Static str:Resources.strConsumableType}" VerticalAlignment="Bottom" Margin="20 0 0 0"
                   FontSize="16"/>
        <ComboBox x:Name="cbConsumableType" Grid.Row="2" Grid.Column="1" Height="30" BorderThickness="0" Background="{DynamicResource lightGrayBrush}" Margin="20 0 0 0"
                  DisplayMemberPath="labwaretype_name" SelectedValuePath="labwaretype_id" SelectionChanged="cbConsumableType_SelectionChanged" IsEditable="False" 
                  IsEnabled="False"/>
 
        <TextBlock Grid.Row="3" Grid.Column="0" Text="{x:Static str:Resources.strManufacturer}" VerticalAlignment="Bottom" Margin="20 0 0 0"
                   FontSize="16"/>
        <!--<TextBox Grid.Row="4" Grid.Column="0" Height="30" FontSize="16" VerticalContentAlignment="Center" Margin="20 0 0 0" Background="{DynamicResource lightGrayBrush}"
                 BorderThickness="0" Text="{Binding brand, Mode=TwoWay}"/>-->
        <TextBox x:Name="txtbrand" Grid.Row="4" Grid.Column="0" Height="30" FontSize="16" VerticalContentAlignment="Center" VerticalAlignment="Top" Background="{DynamicResource lightGrayBrush}" Margin="20 0"
                     BorderThickness="0" >
            <TextBox.Text>
                <Binding Path="brand" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True" >
                    <Binding.ValidationRules>
                        <local:ConsumablesValidationRule  ValidateType="1,6@[256]"/>
                    </Binding.ValidationRules>
                </Binding>
            </TextBox.Text>
        </TextBox>
        <TextBlock Grid.Row="3" Grid.Column="0" x:Name="bError" Text="{Binding  ElementName=txtbrand,Path=(Validation.Errors)[0].ErrorContent}" Foreground="Red" FontSize="16" 
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 5 5 0"/>
 
        <TextBlock Grid.Row="3" Grid.Column="1" Text="{x:Static str:Resources.strProductNo}" VerticalAlignment="Bottom" Margin="20 0 0 0"
                   FontSize="16"/>
        <!--<TextBox Grid.Row="4" Grid.Column="1" Height="30" FontSize="16" VerticalContentAlignment="Center" Margin="20 0 0 0" Background="{DynamicResource lightGrayBrush}"
                 BorderThickness="0" Text="{Binding number, Mode=TwoWay}"/>-->
        <TextBox x:Name="txtnumber" Grid.Row="4" Grid.Column="1" Height="30" FontSize="16" VerticalContentAlignment="Center" VerticalAlignment="Top" Background="{DynamicResource lightGrayBrush}" Margin="20 0"
                     BorderThickness="0" >
            <TextBox.Text>
                <Binding Path="number" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True" >
                    <Binding.ValidationRules>
                        <local:ConsumablesValidationRule  ValidateType="1,6@[256]"/>
                    </Binding.ValidationRules>
                </Binding>
            </TextBox.Text>
        </TextBox>
        <TextBlock Grid.Row="3" Grid.Column="1" x:Name="nError" Text="{Binding  ElementName=txtnumber,Path=(Validation.Errors)[0].ErrorContent}" Foreground="Red" FontSize="16" 
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 5 5 0"/>
 
        <TextBlock Grid.Row="5" Grid.Column="0" Text="{x:Static str:Resources.strDescription}" VerticalAlignment="Bottom" Margin="20 0 0 0"
                   FontSize="16"/>
        <!--<TextBox Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" FontSize="16" VerticalContentAlignment="Top" Margin="20 8 0 0" TextWrapping="Wrap" Background="{DynamicResource lightGrayBrush}"
                 BorderThickness="0" Text="{Binding content,Mode=TwoWay}"/>-->
        <TextBox x:Name="txtcontent" Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" FontSize="16" VerticalContentAlignment="Top"  Margin="20 8 0 0" TextWrapping="Wrap"  Background="{DynamicResource lightGrayBrush}" 
                     BorderThickness="0" >
            <TextBox.Text>
                <Binding Path="content" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True" >
                    <Binding.ValidationRules>
                        <local:ConsumablesValidationRule  ValidateType="1,6@[1024]"/>
                    </Binding.ValidationRules>
                </Binding>
            </TextBox.Text>
        </TextBox>
        <TextBlock Grid.Row="5" Grid.Column="0" x:Name="cError" Text="{Binding  ElementName=txtcontent,Path=(Validation.Errors)[0].ErrorContent}" Foreground="Red" FontSize="16" 
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 5 5 0"/>
 
        <Border Grid.Row="1" Grid.Column="2" Grid.RowSpan="6" BorderThickness="0" Background="#FFF2F3F5" CornerRadius="5" Margin="40 0 0 10">
            <Grid>
                <Image x:Name="imageConsumable" Stretch="Uniform" Source="pack://application:,,,./Assets/Consumables/无图片.png"/>
                <ctrls:ImageButton Grid.Column="3" x:Name="btnUpload" NormalImage="pack://application:,,,./Assets/Consumables/上传.png" Width="40" Height="40" ImageWidth="28" ImageHeight="28" VerticalAlignment="Top" HorizontalAlignment="Right"
                                   Click="btnUpload_Click" Margin="0 10 50 0"/>
                <ctrls:ImageButton Grid.Column="3" x:Name="btnDelete" NormalImage="pack://application:,,,./Assets/Consumables/删除.png" Width="40" Height="40" ImageWidth="28" ImageHeight="28" VerticalAlignment="Top" HorizontalAlignment="Right"
                                   Click="btnDelete_Click"  Margin="0 10 10 0"/>
            </Grid>
            <!--<Border.Triggers>
                <EventTrigger RoutedEvent="Mouse.MouseEnter">
                    <BeginStoryboard>
                        <Storyboard>
                            <ColorAnimation Duration="0:0:0.5" Storyboard.TargetProperty="Background.Color" To="LightGray" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Border.Triggers>-->
        </Border>
    </Grid>
    
</UserControl>