UsrPrintTemplateleft.xaml
9.4 KB
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
<UserControl x:Class="SmartScan.SetControl.WPF.UsrPrintTemplateleft"
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:SmartScan.SetControl.WPF"
Loaded="UserControl_Loaded"
mc:Ignorable="d" >
<UserControl.Resources>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="White"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style TargetType="Button">
<Setter Property="Background" Value="#1c1c1c"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderBrush" Value="#0078d7"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="10,5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="{TemplateBinding Padding}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#0078d7"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#005a9e"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<!-- 左侧面板 - 标签模板列表 -->
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Background="#1A1A1A" BorderBrush="#0078d7" BorderThickness="1" Padding="10,5">
<TextBlock Text="标签模板" Name="UsrPrintTemplate_pnlPrintTmpLst" FontFamily="微软雅黑" FontSize="14" HorizontalAlignment="Center"/>
</Border>
<ListView x:Name="LstLabel" Grid.Row="1"
Background="#1c1c1c"
BorderThickness="1"
BorderBrush="#0078d7"
Foreground="White"
SelectionChanged="LstLabel_SelectedIndexChanged"
SelectedIndex="-1"
HorizontalContentAlignment="Center">
<!-- 设置交替行数为2 -->
<ListView.AlternationCount>2</ListView.AlternationCount>
<!-- 自定义每个项的显示模板 -->
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontSize="14" FontFamily="微软雅黑"/>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Padding" Value="10,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListViewItem">
<Border x:Name="Border"
Background="{TemplateBinding Background}"
BorderThickness="0">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True"/>
<Condition Property="Selector.IsSelectionActive" Value="True"/>
</MultiTrigger.Conditions>
<Setter TargetName="Border" Property="Background" Value="#005A9E"/>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<!-- 交替行颜色 -->
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#353535"/>
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#2a2a2a"/>
</Trigger>
<!-- 选中行颜色 - 只有在真正选中时才应用 -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True"/>
<Condition Property="Selector.IsSelectionActive" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Background" Value="#0061c8"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</MultiTrigger>
<!-- 鼠标悬停效果 -->
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#464646"/>
</Trigger>
</Style.Triggers>
</Style>
</ListView.ItemContainerStyle>
</ListView>
<Border Grid.Row="2" Background="#1A1A1A" BorderBrush="#0078d7" BorderThickness="1" Padding="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" FontFamily="微软雅黑" FontSize="14" Name="UsrPrintTemplate_pnlPrintTmpLstOp" Text="标签模板操作" HorizontalAlignment="Center" Margin="0,0,0,10"/>
<UniformGrid Grid.Row="1" Rows="1" Columns="4" Margin="0,5">
<Button Margin="2" Click="BtnAddLabel_Click">
<StackPanel>
<TextBlock Text="+" FontSize="18" FontFamily="微软雅黑" HorizontalAlignment="Center"/>
<TextBlock x:Name="UsrPrintTemplate_BtnAddLabel" Text="新建标签" FontFamily="微软雅黑" FontSize="14" HorizontalAlignment="Center"/>
</StackPanel>
</Button>
<Button Margin="2" Click="BtnDelLabel_Click">
<StackPanel>
<TextBlock Text="-" FontSize="18" FontFamily="微软雅黑" HorizontalAlignment="Center"/>
<TextBlock Text="删除标签" x:Name="UsrPrintTemplate_BtnDelLabel" FontFamily="微软雅黑" FontSize="14" HorizontalAlignment="Center"/>
</StackPanel>
</Button>
<Button Margin="2" Click="BtnCopyLabel_Click">
<StackPanel>
<TextBlock Text="⎘" FontSize="18" HorizontalAlignment="Center"/>
<TextBlock x:Name="UsrPrintTemplate_BtnCopyLabel" Text="复制标签" FontFamily="微软雅黑" FontSize="14" HorizontalAlignment="Center"/>
</StackPanel>
</Button>
<Button Margin="2" Click="BtnRenameLabel_Click">
<StackPanel>
<TextBlock Text="✎" FontSize="18" HorizontalAlignment="Center"/>
<TextBlock x:Name="UsrPrintTemplate_BtnRenameLabel" Text="重命名" FontFamily="微软雅黑" FontSize="14" HorizontalAlignment="Center"/>
</StackPanel>
</Button>
</UniformGrid>
</Grid>
</Border>
</Grid>
</Grid>
</UserControl>