schangxiang@126.com
2025-11-04 ca398287db3f5ea01f03aac4a85edb13b28100a6
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
<UserControl x:Class="XHandler.View.TestDesign"
             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"
             xmlns:ctrls="clr-namespace:XHandler.Controls"
             xmlns:cls ="clr-namespace:XHandler.Class.DataEx"
             xmlns:str="clr-namespace:XHandler.Properties"
             mc:Ignorable="d" 
             d:DesignHeight="960" d:DesignWidth="1280" Loaded="UserControl_Loaded" PreviewKeyDown="UserControl_PreviewKeyDown">
    
    <UserControl.Resources>
        <!--#region 指令集 style-->
        <Style x:Key="ListBoxStyle1" TargetType="{x:Type ListBox}">
            <Setter Property="Background" Value="White"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
            <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
            <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
            <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="VerticalAlignment" Value="Stretch"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBox}">
                        <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="1" SnapsToDevicePixels="true">
                            <ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
                                <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </ScrollViewer>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <StackPanel/>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="ItemContainerStyle">
                <Setter.Value>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="ListBoxItem">
                                    <Border x:Name="Border" Margin="0" Height="auto" BorderThickness="0"  Padding="1" Background="{TemplateBinding Background}">
                                        <Expander Header="{Binding GroupName}" Style="{DynamicResource MethodGroupExpanderStyle}" IsExpanded="True">
 
                                            <!--Width="400"-->
                                            <ListView ItemsSource="{Binding Children}" ItemsPanel="{DynamicResource NormalItemsPanel}"
                                                      ItemContainerStyle="{DynamicResource ListViewItemStyle}" ItemTemplate="{DynamicResource ListViewItemDataTemplate}"
                                                      Width="{Binding Converter={StaticResource percentageConverter}, ElementName=listboxCmd, Path=ActualWidth, ConverterParameter=0.95}"
                                                      BorderThickness="0"  PreviewMouseLeftButtonDown="ListView_PreviewMouseLeftButtonDown" PreviewMouseMove="ListView_PreviewMouseMove"
                                                      QueryContinueDrag="DoQueryContinueDrag" Background="Transparent" />
                                        </Expander>
                                    </Border>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </Setter.Value>
            </Setter>
        </Style>
        <!--#endregion-->
 
        <!--#endregion-->
 
        <!--#region ListView样式-->
        <Style x:Key="ListViewItemStyle" TargetType="{x:Type ListViewItem}">
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <!--<Setter Property="IsEnabled" Value="False"/>-->
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListViewItem">
                        <Grid>
                            <!--<Border x:Name="bg" Background="Transparent" CornerRadius="5" BorderThickness="0" Margin="3"/>-->
                            <ContentPresenter Margin="5,5,5,5"
                                 Content="{TemplateBinding ContentControl.Content}" 
                                 ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" 
                                 ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" 
                                 HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" 
                                 VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" 
                                 SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" 
                                />
                            <Border x:Name="bg" Background="Transparent" CornerRadius="5" BorderThickness="0" Margin="5"/>
                        </Grid>
 
                        <ControlTemplate.Triggers>
                            <!--<Trigger Property="Selector.IsSelected" Value="True">
                                <Setter Property="Panel.Background" TargetName="bg" Value="#40000000"/>
                            </Trigger>-->
                            <Trigger Property="UIElement.IsEnabled" Value="False">
                                <Setter Property="TextElement.Foreground">
                                    <Setter.Value>
                                        <DynamicResource ResourceKey="{x:Static SystemColors.GrayTextBrushKey}" />
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="UIElement.IsMouseOver" Value="True">
                                <Setter Property="Panel.Background" TargetName="bg" Value="#10000000"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter Property="Panel.Background" TargetName="bg" Value="LightGray"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
 
        <!--命令集: 单个指令-->
        <DataTemplate x:Key="ListViewItemDataTemplate">
            <Grid>
                <!--<Border Width="122" Height="90" CornerRadius="5" Background="{Binding method_group_id,Converter={StaticResource cmdBackgroundConverter}}" />-->
                <!--<Border Width="122" Height="90" CornerRadius="5" Background="LightGray" Visibility="{Binding method_support,Converter={StaticResource intToVisibleConvert}}" />-->
                <!--122-->
                <Border Width="119" Height="90" CornerRadius="5">
                    <Border.Background>
                        <MultiBinding Converter="{StaticResource cmdBackgroundMultiConverter}">
                            <Binding Path="method_group_id"/>
                            <Binding Path="method_support"/>
                        </MultiBinding>
                    </Border.Background>
                </Border>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="30"/>
                    </Grid.RowDefinitions>
                    <!--<Image Grid.Row="0" Name="idImage" Source="{Binding method_ico, Converter={StaticResource cmdIconConvert}}" Stretch="Uniform" Height="32"/>-->
                    <Image Grid.Row="0" Name="idImage" Stretch="Uniform" Height="32">
                        <Image.Source>
                            <MultiBinding Converter="{StaticResource cmdIconMultiConvert}">
                                <Binding Path="method_ico"/>
                                <Binding Path="method_support"/>
                                <Binding Path="method_group_id"/>
                            </MultiBinding>
                        </Image.Source>
                    </Image>
 
                    <TextBlock Grid.Row="1" x:Name="idText" Text="{Binding method_name}" Margin="5,0" FontSize="16" Foreground="Black" TextWrapping="Wrap"
                               VerticalAlignment="Top" HorizontalAlignment="Center" />
                </Grid>
 
            </Grid>
        </DataTemplate>
        <!--#endregion-->
 
        <!--#region WorkFlow style-->
        <PathGeometry x:Key="TreeArrow" Figures="M0,0 L0,6 L6,0 z"/>
        <Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
            <Setter Property="Focusable" Value="False"/>
            <Setter Property="Width" Value="16"/>
            <Setter Property="Height" Value="16"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ToggleButton}">
                        <Border Background="Transparent" Height="16" Padding="5,5,5,5" Width="16">
                            <Path x:Name="ExpandPath" Data="{StaticResource TreeArrow}" Fill="Transparent" Stroke="#FF989898">
                                <Path.RenderTransform>
                                    <RotateTransform Angle="135" CenterY="3" CenterX="3"/>
                                </Path.RenderTransform>
                            </Path>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Stroke" TargetName="ExpandPath" Value="#FF1BBBFA"/>
                                <Setter Property="Fill" TargetName="ExpandPath" Value="Transparent"/>
                            </Trigger>
                            <Trigger Property="IsChecked" Value="True">
                                <Setter Property="RenderTransform" TargetName="ExpandPath">
                                    <Setter.Value>
                                        <RotateTransform Angle="180" CenterY="3" CenterX="3"/>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="Fill" TargetName="ExpandPath" Value="#FF595959"/>
                                <Setter Property="Stroke" TargetName="ExpandPath" Value="#FF262626"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
 
        <Style x:Key="workflowTreeViewStyle" TargetType="{x:Type TreeView}">
            <Setter Property="ScrollViewer.CanContentScroll" Value="True" />
            <Setter Property="VirtualizingStackPanel.IsVirtualizing" Value="True"></Setter>
            <Setter Property="VirtualizingStackPanel.VirtualizationMode" Value="Recycling" />
            <Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
            <Setter Property="ItemContainerStyle" Value="{DynamicResource workflowTreeViewItem}"></Setter>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel IsItemsHost="True" Margin="0"/>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
        </Style>
 
        <Style x:Key="workflowTreeViewItem" TargetType="{x:Type TreeViewItem}">
            <Setter Property="IsExpanded" Value="True"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Margin" Value="8"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="FontFamily" Value="Microsoft YaHei"/>
            <Setter Property="BorderBrush" Value="AliceBlue"/>
            <Setter Property="IsSelected" Value="{Binding isSelected, Mode=OneWay}"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TreeViewItem}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition MinWidth="1" Width="Auto"/>
                                <ColumnDefinition Width="5"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <ToggleButton x:Name="Expander" ClickMode="Press" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" Visibility="Visible"/>
                            <Rectangle x:Name="Hd" Grid.Column="1" Fill="{DynamicResource blueBrush}" Opacity="0"/>
                            <Border x:Name="Bd" Grid.Column="2" BorderThickness="0 0 0 2"  Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                                <Border.BorderBrush>
                                    <VisualBrush>
                                        <VisualBrush.Visual>
                                            <Rectangle StrokeDashArray="4 4" Stroke="LightGray" StrokeThickness="1"
                                                Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}"
                                                Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualHeight}"/>
                                        </VisualBrush.Visual>
                                    </VisualBrush>
                                </Border.BorderBrush>
 
                                <ContentPresenter x:Name="PART_Header" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </Border>
                            <ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsExpanded" Value="false">
                                <Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
                            </Trigger>
                            <Trigger Property="HasItems" Value="false">
                                <Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
                            </Trigger>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter Property="Background" TargetName="Bd" Value="#259FFF"/>
                                <Setter Property="Foreground" Value="White"/>
                            </Trigger>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsSelected" Value="true"/>
                                    <Condition Property="IsSelectionActive" Value="false"/>
                                </MultiTrigger.Conditions>
                                <Setter Property="Background" TargetName="Bd" Value="Transparent"/>
                                <Setter Property="Foreground" Value="White"/>
                            </MultiTrigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
 
            <Style.Triggers>
                <Trigger Property="VirtualizingStackPanel.IsVirtualizing" Value="true">
                    <Setter Property="ItemsPanel">
                        <Setter.Value>
                            <ItemsPanelTemplate>
                                <VirtualizingStackPanel/>
                            </ItemsPanelTemplate>
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </Style.Triggers>
        </Style>
 
        <Style x:Key="TreeViewItemStyle1" TargetType="{x:Type TreeViewItem}">
            <Setter Property="IsSelected" Value="{Binding isSelected, Mode=OneWay}"/>
            <Setter Property="IsExpanded" Value="True"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="Padding" Value="1,0,0,0"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TreeViewItem}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition MinWidth="1" Width="auto"/>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <!--<ToggleButton x:Name="Expander" ClickMode="Press" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" Visibility="Collapsed"/>-->
                            <ToggleButton x:Name="Expander" Grid.Row="0" Grid.Column="0" Style="{StaticResource ExpandCollapseToggleStyle}" ClickMode="Press" IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"/>
 
                            <Rectangle x:Name="Hd" Grid.Column="1" Fill="{DynamicResource blueBrush}" Opacity="0" Width="5"/>
                            <Border x:Name="Bd" Grid.Column="2" BorderThickness="0 0 0 2"  Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                                <Border.BorderBrush>
                                    <VisualBrush>
                                        <VisualBrush.Visual>
                                            <Rectangle StrokeDashArray="4 4" Stroke="LightGray" StrokeThickness="1"
                                                Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}"
                                                Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualHeight}"/>
                                        </VisualBrush.Visual>
                                    </VisualBrush>
                                </Border.BorderBrush>
 
                                <ContentPresenter x:Name="PART_Header" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </Border>
                            <ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsExpanded" Value="false">
                                <Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
                            </Trigger>
                            <Trigger Property="HasItems" Value="false">
                                <Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
                            </Trigger>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter Property="Opacity" TargetName="Hd" Value="1"/>
                                <Setter Property="Background" TargetName="Bd" Value="#FFDBECFF"/>
                                <!--<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>-->
                            </Trigger>
                            <!--<Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Background" TargetName="Bd" Value="#FFDBECFF"/>
                            </Trigger>-->
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsSelected" Value="true"/>
                                    <Condition Property="IsSelectionActive" Value="false"/>
                                </MultiTrigger.Conditions>
                                <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/>
                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}"/>
                            </MultiTrigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="VirtualizingPanel.IsVirtualizing" Value="true">
                    <Setter Property="ItemsPanel">
                        <Setter.Value>
                            <ItemsPanelTemplate>
                                <VirtualizingStackPanel/>
                            </ItemsPanelTemplate>
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </Style.Triggers>
        </Style>
 
        <HierarchicalDataTemplate x:Key="treeviewTemplate" DataType="{x:Type cls:MethodExEx}" ItemsSource="{Binding Children}">
            <Border Width="auto" Height="56" Margin="{Binding Level, Converter={StaticResource leverToThicknessConvert}}">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" FontSize="14" Text="{Binding strIndex}" VerticalAlignment="Center" HorizontalAlignment="Left" FontWeight="Bold"
                               Foreground="{Binding isEnabled, Converter={StaticResource enableToBrush}}" Margin="10 0"/>
                    <Image Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Stretch="Uniform" Height="32">
                        <Image.Source>
                            <MultiBinding Converter="{StaticResource workflowIconMultiConvert}">
                                <Binding Path="method_ico"/>
                                <Binding Path="isEnabled"/>
                                <Binding Path="method_group_id"/>
                            </MultiBinding>
                        </Image.Source>
                    </Image>
 
                    <TextBlock Grid.Column="2" FontSize="16" Text="{Binding method_name}" VerticalAlignment="Center" 
                               Foreground="{Binding isEnabled, Converter={StaticResource enableToBrush}}"/>
 
                    <TextBlock Grid.Column="3" FontSize="14" Margin="20,0,0,0" HorizontalAlignment="Left" Text="{Binding method_Tipcontent}" VerticalAlignment="Center" 
                               Foreground="{Binding isEnabled, Converter={StaticResource enableToBrush}}" TextWrapping="WrapWithOverflow"/>
 
                    <!--<Rectangle Grid.Column="0" Grid.ColumnSpan="4" Stroke="LightGray" Height="1" StrokeThickness="2" StrokeDashArray="3 3" VerticalAlignment="Bottom" HorizontalAlignment="Stretch"/>-->
                </Grid>
            </Border>
        </HierarchicalDataTemplate>
 
        <!--#endregion-->
 
        <DataTemplate x:Key="ConsumableListViewItemDataTemplate1">
            <Border Width="110" Height="100" >
                <Grid Margin="2">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="30"/>
                    </Grid.RowDefinitions>
                    <!--<Image Grid.Row="0" Name="idImage" Source="{Binding method_ico, Converter={StaticResource cmdIconConvert}}" Stretch="Uniform" Height="32"/>-->
                    <ctrls:ControlLabware Grid.Row="0" LabwareWidth="90" LabwareHeight="50"
                                      LeftSideColor="{Binding labware_color_lside,Converter={StaticResource colorConvert}}" 
                                      FrontColor="{Binding labware_color_front,Converter={StaticResource colorConvert}}" 
                                      TopColor="{Binding labware_color_top,Converter={StaticResource colorConvert}}" 
                                      BorderColor="{Binding labware_color_line,Converter={StaticResource colorConvert}}" 
                                      labwareWellInfoList="{Binding labwareWellInfoList}"
                                      LabwareRealLength="{Binding labware_length}" LabwareRealWidth="{Binding labware_width}"
                                      Rows="{Binding number_row}" Columns="{Binding number_column}" WellColor="White" IsFill="true"
                                      LabwareType="{Binding labware_type_id}" LabwareName="{Binding labware_name}"/>
                    
                    <TextBlock Grid.Row="1" x:Name="idText" Text="{Binding labware_name}" FontSize="14" Foreground="Black" TextTrimming="WordEllipsis"
                               VerticalAlignment="Center" HorizontalAlignment="Center" ToolTip="{Binding labware_name}"/>
                </Grid>
            </Border>
        </DataTemplate>
 
        <!--#region workflow menu-->
        <ContextMenu x:Key="workflowMenu" Width="140">
            <MenuItem x:Name="workflowMenuCopy" Header="{x:Static str:Resources.strCopy}" Click="workflowMenuCopy_Click"/>
            <MenuItem x:Name="workflowMenuPaste" Header="{x:Static str:Resources.strPaste}" IsEnabled="False"  Click="workflowMenuPaste_Click"/>
            <MenuItem x:Name="workflowMenuDisable" Header="{x:Static str:Resources.strDisable}" Click="workflowMenuDisable_Click"/>
            <MenuItem x:Name="workflowMenuDelete" Header="{x:Static str:Resources.strDeleteWithKey}" Click="workflowMenuDelete_Click"/>
            <MenuItem x:Name="workflowMenuRun" Header="{x:Static str:Resources.strRunThis}" Click="workflowMenuRun_Click"/>
            <MenuItem x:Name="workflowMenuStepRun" Header="{x:Static str:Resources.strStepRun}" Click="workflowMenuStepRun_Click"/>
        </ContextMenu>
        <!--#endregion-->
 
        <!--#region Table menu-->
        <ContextMenu x:Key="tableMenu" x:Name="tableMenu" Width="150">
            <MenuItem x:Name="tableMenuLabel" Header="{x:Static str:Resources.strLabel}" Click="tableMenuLabel_Click"/>
            <!--通过右击属性设置barcode-->
            <!--<MenuItem x:Name="tableMenuBarCode" Header="{x:Static str:Resources.strLabwareBarcode}" Click="tableMenuBarCode_Click"/>-->
            <MenuItem x:Name="tableMenuDeleteLabware" Header="{x:Static str:Resources.strDelete}" Click="tableMenuDeleteLabware_Click"/>
            <MenuItem x:Name="tableMenuCopyLabware" Header="{x:Static str:Resources.strCopy}" Click="tableMenuCopyLabware_Click"/>
            <MenuItem x:Name="tableMenuPasteLabware" Header="{x:Static str:Resources.strPaste}" Click="tableMenuPasteLabware_Click" IsEnabled="False"/>
            <MenuItem x:Name="tableMenuProperty" Header="{x:Static str:Resources.strProperty}" Click="tableMenuProperty_Click"/>
        </ContextMenu>
        <!--#endregion-->
    </UserControl.Resources>
    
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="3*" MinWidth="250" MaxWidth="450"/>
            <ColumnDefinition Width="3*"/>
            <ColumnDefinition Width="3.5*"/>
        </Grid.ColumnDefinitions>
 
        <!--#region 命令集 -->
        <Grid Grid.Column="0" x:Name="gridCmdSet">
            <Border Background="White" CornerRadius="0,10,10,0" Margin="0,0,10,0">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40"/>
                        <RowDefinition Height="50"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Text="{x:Static str:Resources.strCommandSet}" VerticalAlignment="Center" Margin="20 0 0 0"
                               FontSize="20" FontWeight="Black"/>
 
                    <ctrls:SearchTextBox x:Name="searchMethod" Grid.Row="1" Background="#FFF7F8FA" Watermark="{x:Static str:Resources.strInputSearch}" VerticalAlignment="Center" Height="50" Margin="20,0"
                                         FontSize="20" VerticalContentAlignment="Center" PreviewKeyDown="searchMethod_PreviewKeyDown"
                                         clearEvent="searchMethod_clearEvent" Width="{Binding Converter={StaticResource percentageConverter}, ElementName=listboxCmd, Path=ActualWidth, ConverterParameter=0.95}"/>
 
                    <ListBox Grid.Row="2" x:Name="listboxCmd" Margin="20 20 0 20" Style="{DynamicResource ListBoxStyle1}"
                             PreviewMouseWheel="listboxCmd_PreviewMouseWheel" ScrollViewer.CanContentScroll="False"/>
                </Grid>
            </Border>
        </Grid>
        <!--#endregion-->
 
        <!--#region 实验方法 -->
        <Grid Grid.Column="1">
            <Border Background="White" CornerRadius="10" Margin="0,0,10,0">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Text="{x:Static str:Resources.strWorkflow}" VerticalAlignment="Center" Margin="20 0 0 0"
                               FontSize="20" FontWeight="Black"/>
                    <TextBlock Grid.Row="0" x:Name="tbSelectCount" Text="" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 5 15 5" Visibility="Collapsed"/>
 
                    <TreeView x:Name="treeviewWorkflow" Grid.Row="1" Margin="10 0 10 0" Background="White"
                              ItemContainerStyle="{DynamicResource TreeViewItemStyle1}" ItemTemplate="{DynamicResource treeviewTemplate}"
                              BorderThickness="0" AllowDrop="True" 
                              Drop="treeviewWorkflow_Drop" ContextMenu="{DynamicResource workflowMenu}"
                              PreviewMouseMove="treeviewWorkflow_PreviewMouseMove"
                              PreviewMouseDown="treeviewWorkflow_PreviewMouseDown"
                              QueryContinueDrag="DoQueryContinueDrag"
                              PreviewDragOver="treeviewWorkflow_PreviewDragOver"
                              SelectedItemChanged="treeviewWorkflow_SelectedItemChanged"
                              PreviewMouseRightButtonDown="treeviewWorkflow_PreviewMouseRightButtonDown"
                              ctrls:TreeViewExtensions.EnableMultiSelect="true" ctrls:TreeViewExtensions.SelectedItems="{Binding SelectedItemList}"
                                 >
                    </TreeView>
                </Grid>
            </Border>
        </Grid>
        <!--#endregion-->
 
        <!--#region 耗材选择 -->
        <Grid Grid.Column="2" x:Name="grid2">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="*" x:Name="gridRowConsumable"/>
                <RowDefinition Height="auto" x:Name="gridRowDef"/>
            </Grid.RowDefinitions>
            
            <Grid Grid.Row="0">
                <Border x:Name="borderConsumable" Background="White" CornerRadius="10" Margin="0,0,0,10" >
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="40"/>
                            <RowDefinition Height="40"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <!--耗材选择-->
                        <TextBlock Grid.Row="0" Text="{x:Static str:Resources.strConsumableSelect}" VerticalAlignment="Center" Margin="20 0 0 0"
                               FontSize="20" FontWeight="Black"/>
                        <StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" Name="pnlLabware">
                            <TextBlock Text="{x:Static str:Resources.strType}" FontSize="16" Margin="20 0 0 0" VerticalAlignment="Center"/>
                            <ComboBox x:Name="cbLabwareType" Height="30" BorderThickness="0" Background="#FFF7F8FA" 
                                      DisplayMemberPath="labwaretype_name" SelectedValuePath="labwaretype_id" IsEditable="False"
                                      SelectionChanged="cbLabwareType_SelectionChanged" Margin="5 0 0 0" MaxWidth="150"
                                      Width="{Binding Converter={StaticResource percentageConverter}, ElementName=pnlLabware, Path=ActualWidth, ConverterParameter=0.25}"/>
                            
                            <ctrls:SearchTextBox x:Name="searchLabware" Grid.Row="1" Background="#FFF7F8FA" Watermark="{x:Static str:Resources.strInputSearch}"
                                                 VerticalAlignment="Center" Margin="10 0 0 0" FontSize="14" VerticalContentAlignment="Center" Height="30" 
                                                 Width="{Binding Converter={StaticResource percentageConverter}, ElementName=pnlLabware, Path=ActualWidth, ConverterParameter=0.53}"
                                                 PreviewKeyDown="searchLabware_PreviewKeyDown"
                                                 clearEvent="searchLabware_clearEvent"/>
                        </StackPanel>
 
                        <!--耗材一览-->
                        <ListView x:Name="listviewConsumable" Grid.Row="2" Margin="10 0 10 10"
                                  ItemsPanel="{DynamicResource NormalItemsPanel}" Background="#FFF7F8FA"
                                  ItemContainerStyle="{DynamicResource ConsumableListViewItemStyle}" ItemTemplate="{DynamicResource ConsumableListViewItemDataTemplate1}"
                                  BorderThickness="0" ScrollViewer.VerticalScrollBarVisibility="Auto"
                                  PreviewMouseDown="listviewConsumable_PreviewMouseDown" PreviewMouseMove="listviewConsumable_PreviewMouseMove" 
                                  QueryContinueDrag="DoQueryContinueDrag" Height="200"/>
                    </Grid>
                </Border>
            </Grid>
 
            <Grid Grid.Row="1">
                <Border x:Name="borderTableOuter" Background="White" CornerRadius="10" BorderThickness="0" HorizontalAlignment="Stretch">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="40"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        
                        <TextBlock Grid.Row="0" Text="{x:Static str:Resources.strTableLayout}" VerticalAlignment="Center" Margin="20 0 0 0"
                               FontSize="20" FontWeight="Black"/>
                        <Button Grid.Row="0" x:Name="btnResetTable" Content="重置台面" Style="{DynamicResource LinkButton}" FontSize="18"
                                VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0 10 20 0" Click="btnResetTable_Click" 
                                Foreground="{DynamicResource blueBrush}"/>
 
                        <!--Background="#FFF7F8FA"-->
                        <Border x:Name="borderTable" Grid.Row="1" CornerRadius="0" VerticalAlignment="Top" Background="#FFF7F8FA">
                            <Grid>
                                <!--台面布置格子-->
                                <!--<Grid x:Name="gridTable" Margin="5 10" Width="{Binding Converter={StaticResource percentageConverter}, ElementName=borderTable, Path=ActualWidth, ConverterParameter=0.9}"
                                      MinHeight="200"/>-->
                                <Grid x:Name="gridTable" Margin="20 10" MinHeight="300" Loaded="gridTable_Loaded"/>
                                <Image x:Name="imgdish" Margin="0 10 20 0" HorizontalAlignment="Right" VerticalAlignment="Top" Source="/Assets/dish.png" Stretch="Fill" />
                                <Image x:Name="imgdish1" Margin="0 10 20 0" HorizontalAlignment="Right" VerticalAlignment="Top" Source="/Assets/dish1.png" Stretch="Fill" Visibility="Collapsed"/>
                            </Grid>
                        </Border>
                    </Grid>
                </Border>
            </Grid>
 
            <Grid Grid.Row="2" >
                <Border x:Name="borderProperty" Background="White" CornerRadius="10" Visibility="Collapsed" Margin="0 10 0 0">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="40"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
 
                        <TextBlock Grid.Row="0" Text="{x:Static str:Resources.strCmdProperty}" VerticalAlignment="Center" Margin="20 0 0 0"
                               FontSize="20" FontWeight="Black"/>
 
                        <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
                            <Grid  x:Name="gridProperty" Margin="10 10" Width="700"/>
                        </ScrollViewer>
 
                    </Grid>
                </Border>
            </Grid>
        </Grid>
        <!--#endregion-->
    </Grid>
</UserControl>