alielie
2026-09-10 9ec80cafc23f5ee3278cacce3c9f86f4087b435a
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
<Window x:Class="OpenTapEditor.StepWindow"
        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:OpenTapEditor"
        mc:Ignorable="d"
        xmlns:pu="https://opensource.panuon.com/wpf-ui"
        WindowStartupLocation="CenterOwner"
        FontSize="{DynamicResource GlobalFontSize}"
        Title="{DynamicResource 自定义测试步骤}" Height="800" Width="1200">
    <Window.Resources>
        <Style x:Key="itemstyle" TargetType="{x:Type ListViewItem}">
            <EventSetter Event="MouseDoubleClick" Handler="HandleDoubleClick" />
        </Style>
 
        <CollectionViewSource x:Key="GroupFilter" Source="{Binding CustomSteps}">
            <CollectionViewSource.GroupDescriptions>
                <PropertyGroupDescription PropertyName="GroupBy" />
            </CollectionViewSource.GroupDescriptions>
        </CollectionViewSource>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <GroupBox Header="{DynamicResource 原型}">
            <ListView ItemsSource="{Binding Steps}" SelectedItem="{Binding TargetType}"
                       AlternationCount="2"
                       ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                <ListView.ItemContainerStyle>
                    <Style TargetType="ListViewItem">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate>
                                    <Border x:Name="border" Padding="3" BorderThickness="0,0,0,1"
                                                BorderBrush="{StaticResource BorderBrush}">
                                        <DockPanel Background="Transparent" x:Name="dock" Margin="3">
                                            <Button DockPanel.Dock="Right" 
                                                    Style="{StaticResource LinkButton}" Click="Button_Click"
                                                    DataContext="{Binding }"
                                                    Content="{DynamicResource 创建}"
                                                    Tag="Create"/>
                                            <TextBlock Text="{Binding Name}"/>
                                        </DockPanel>
                                    </Border>
                                    
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="ItemsControl.AlternationIndex" Value="1">
                                            <Setter TargetName="border" Property="Background" Value="#e9eef5"/>
                                        </Trigger>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter TargetName="border" Property="Background" Value="#e5f3fb"/>
                                        </Trigger>
                                        <Trigger Property="ListViewItem.IsSelected" Value="True">
                                            <Setter TargetName="border" Property="Background" Value="#cbe8f6"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ListView.ItemContainerStyle>
            </ListView>
        </GroupBox>
        <GroupBox Grid.Column="1" Header="{DynamicResource 自定义测试步骤}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <ListView Grid.Row="1" SelectedItem="{Binding TargetType}"
                          ItemsSource="{Binding Source={StaticResource GroupFilter}}"
                          AlternationCount="2">
                    <ListView.GroupStyle>
                        <GroupStyle>
                            <GroupStyle.ContainerStyle>
                                <Style TargetType="{x:Type GroupItem}">
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="{x:Type GroupItem}">
                                                <Expander pu:ExpanderHelper.CornerRadius="0"
                                                          BorderBrush="White" BorderThickness="0,0,0,1"
                                                          Background="{DynamicResource PrimaryBrush}"
                                      IsExpanded="True">
                                                    <Expander.Header>
                                                        <TextBlock Text="{Binding Name}" Margin="8" Foreground="#FFF"/>
                                                    </Expander.Header>
                                                    <Border Background="#FFF">
                                                        <ItemsPresenter />
                                                    </Border>
                                                </Expander>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </GroupStyle.ContainerStyle>
                        </GroupStyle>
                    </ListView.GroupStyle>
 
 
                    <ListView.ItemContainerStyle>
                        <Style TargetType="ListViewItem">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate>
                                        <Border x:Name="border" Padding="3" BorderThickness="0,0,0,1"
                                                BorderBrush="{StaticResource BorderBrush}">
                                            <DockPanel Background="Transparent" x:Name="dock" Margin="3">
                                                <Button DockPanel.Dock="Right" Margin="10,0,0,0"
                                                        Style="{StaticResource LinkButton}"
                                                        Click="Button_Click" DataContext="{Binding }" Foreground="{DynamicResource ErrorBrush}" 
                                                        Tag="Delete" Content="{DynamicResource 删除}"/>
                                                <Button DockPanel.Dock="Right" Margin="10,0,0,0"
                                                        Style="{StaticResource LinkButton}"
                                                        Click="Button_Click" DataContext="{Binding }" Tag="Edit" Content="{DynamicResource 编辑}"/>
                                                <Button DockPanel.Dock="Right" 
                                                        Style="{StaticResource LinkButton}" 
                                                        Click="Button_Click" DataContext="{Binding }" Tag="Copy" Content="{DynamicResource 复制}"/>
                                                <TextBlock Text="{Binding Name}"/>
                                            </DockPanel>
                                        </Border>
 
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="ItemsControl.AlternationIndex" Value="1">
                                                <Setter TargetName="border" Property="Background" Value="#e9eef5"/>
                                            </Trigger>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter TargetName="border" Property="Background" Value="#e5f3fb"/>
                                            </Trigger>
                                            <Trigger Property="ListViewItem.IsSelected" Value="True">
                                                <Setter TargetName="border" Property="Background" Value="#cbe8f6"/>
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ListView.ItemContainerStyle>
                </ListView>
            </Grid>
        </GroupBox>
    </Grid>
</Window>