forked from DynamoDS/Dynamo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PackageManagerSearchView.xaml
516 lines (408 loc) · 33.5 KB
/
PackageManagerSearchView.xaml
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
<Window x:Class="Dynamo.PackageManager.UI.PackageManagerSearchView"
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:ui="clr-namespace:Dynamo.UI"
xmlns:p="clr-namespace:Dynamo.Wpf.Properties"
xmlns:controls="clr-namespace:Dynamo.Controls"
xmlns:viewModels="clr-namespace:Dynamo.PackageManager.ViewModels"
mc:Ignorable="d"
Title="{x:Static p:Resources.PackageSearchViewTitle}" Name="PackageSearch" Height="600" Width="490" MinWidth="490" MaxWidth="490">
<Window.Resources>
<ResourceDictionary>
<!-- An unstyled button -->
<Style x:Key="FlatButton" TargetType="Button">
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Name="BorderInterior" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="true">
</Trigger>
<Trigger Property="IsDefaulted" Value="true">
</Trigger>
<Trigger Property="IsPressed" Value="true">
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="true">
</Trigger>
<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="IsMouseOver" Value="True">
<Setter Property="Background" Value="#44000000" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="FontWeight" Value="Normal" />
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="FontWeight" Value="Normal" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="DownloadVersionButton" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border x:Name="container" Background="Transparent">
<TextBlock x:Name="text"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="4,0"
FontSize="11"
Foreground="#BBB"
FontWeight="Bold"
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="Button.IsMouseOver" Value="true">
<Setter TargetName="container"
Property="Background"
Value="#333333" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="text"
Property="Foreground"
Value="#666" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<controls:EmptyStringToCollapsedConverter x:Key="EmptyStringToCollapsedConverter" />
<controls:BoolToVisibilityCollapsedConverter x:Key="BooleanToVisibilityCollapsedConverter" />
<controls:PrettyDateConverter x:Key="PrettyDateConverter" />
<ResourceDictionary.MergedDictionaries>
<ui:SharedResourceDictionary Source="{x:Static ui:SharedDictionaryManager.DynamoModernDictionaryUri}" />
<ui:SharedResourceDictionary Source="{x:Static ui:SharedDictionaryManager.DynamoConvertersDictionaryUri}"/>
<ui:SharedResourceDictionary Source="{x:Static ui:SharedDictionaryManager.DynamoColorsAndBrushesDictionaryUri}" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="2"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Background="Black" Grid.Row="1" MinHeight="200">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row ="1" Grid.ZIndex ="1" FontSize="13" HorizontalAlignment="Center" Foreground="Gray" VerticalAlignment="Center" Name="NoResultsIndicator" TextAlignment="Center" Margin="20" Text="{Binding Path=SearchState, Converter={StaticResource PackageSearchStateToStringConverter}}"/>
<Grid Name="RSearchBoxStackPanel" Grid.Row="0" Background="#222">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBox Visibility="{Binding ShowSearchText, Converter={StaticResource BooleanToVisibilityConverter}}" Text="{Binding Path=SearchText, Mode=TwoWay}"
Grid.Column="0" Name="SearchTextBox" KeyboardNavigation.TabIndex="0" Foreground="WhiteSmoke" Background="Transparent" CaretBrush="White"
BorderThickness="0" FontSize ="13" Padding="10,10,5,10" Margin ="0" TextChanged="SearchTextBox_TextChanged" VerticalAlignment="Stretch">
</TextBox>
<TextBlock Text="{Binding SearchBoxPrompt}" Visibility="{Binding Path=SearchText, Converter={StaticResource NonEmptyStringToCollapsedConverter}}"
Grid.Column="0" FontSize ="13" Padding="20,10,5,10" Margin ="0" Background="Transparent" Foreground="#666" IsHitTestVisible="False">
</TextBlock>
<Button Width="auto" MinWidth="80" Grid.Column="1" Click="OnSortButtonClicked"
Style="{DynamicResource ResourceKey=STextButton}" Content="{x:Static p:Resources.PackageSearchViewSortByButton}">
<Button.ContextMenu>
<ContextMenu>
<MenuItem Command="{Binding Path=SetSortingKeyCommand}" CommandParameter="Name" Margin="3"
IsCheckable="True" Header="{x:Static p:Resources.PackageSearchViewContextMenuSortByName}"
IsChecked="{Binding Path=SortingKey, Converter={StaticResource EnumToBoolConverter},ConverterParameter=Name, Mode=TwoWay}" />
<MenuItem Command="{Binding Path=SetSortingKeyCommand}" CommandParameter="LastUpdate" Margin="3"
IsCheckable="True" Header="{x:Static p:Resources.PackageSearchViewContextMenuSortyByUpdate}"
IsChecked="{Binding Path=SortingKey, Converter={StaticResource EnumToBoolConverter},ConverterParameter=LastUpdate, Mode=TwoWay}" />
<MenuItem Command="{Binding Path=SetSortingKeyCommand}" CommandParameter="Downloads" Margin="3"
IsCheckable="True" Header="{x:Static p:Resources.PackageSearchViewContextMenuSortByDownloads}"
IsChecked="{Binding Path=SortingKey, Converter={StaticResource EnumToBoolConverter},ConverterParameter=Downloads, Mode=TwoWay}" />
<MenuItem Command="{Binding Path=SetSortingKeyCommand}" CommandParameter="Votes" Margin="3"
IsCheckable="True" Header="{x:Static p:Resources.PackageSearchViewContextMenuSortByVotes}"
IsChecked="{Binding Path=SortingKey, Converter={StaticResource EnumToBoolConverter},ConverterParameter=Votes, Mode=TwoWay}" />
<MenuItem Command="{Binding Path=SetSortingKeyCommand}" CommandParameter="Maintainers" Margin="3"
IsCheckable="True" Header="{x:Static p:Resources.PackageSearchViewContextMenuSortByAuthor}"
IsChecked="{Binding Path=SortingKey,Converter={StaticResource EnumToBoolConverter},ConverterParameter=Maintainers, Mode=TwoWay}" />
<Separator></Separator>
<MenuItem Command="{Binding Path=SetSortingDirectionCommand}" CommandParameter="Ascending" Margin="3"
IsCheckable="True" Header="{x:Static p:Resources.PackageSearchViewContextMenuOrderAscending}"
IsChecked="{Binding Path=SortingDirection, Converter={StaticResource EnumToBoolConverter},ConverterParameter=Ascending, Mode=TwoWay}" />
<MenuItem Command="{Binding Path=SetSortingDirectionCommand}" CommandParameter="Descending" Margin="3"
IsCheckable="True" Header="{x:Static p:Resources.PackageSearchViewContextMenuOrderDescending}"
IsChecked="{Binding Path=SortingDirection, Converter={StaticResource EnumToBoolConverter},ConverterParameter=Descending, Mode=TwoWay}" />
</ContextMenu>
</Button.ContextMenu>
</Button>
</Grid>
<ListBox Name="SearchResultsListBox"
ItemsSource="{Binding Path=SearchResults}"
ScrollViewer.VerticalScrollBarVisibility="Visible"
BorderThickness="0"
Padding="0"
Background="Black"
Grid.Column="0"
Grid.Row="1"
SelectedIndex="{Binding Path=SelectedIndex}"
VirtualizingPanel.ScrollUnit="Pixel">
<ListBox.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
</ListBox.Resources>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="0"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Margin" Value="0"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate >
<DataTemplate DataType="viewModels:PackageManagerSearchElementViewModel">
<Border Name="ItemBG" BorderBrush="#444" BorderThickness="0,1,0,0" Background="#333">
<StackPanel Width ="455" Name="SearchEle">
<TextBlock Text="{x:Static p:Resources.PackageSearchViewDeprecated}"
Padding="5"
Foreground ="#555"
ToolTip="{x:Static p:Resources.PackageSearchViewDeprecatedTooltip}"
FontSize="10">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding Model.IsDeprecated}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
<DataTrigger Binding="{Binding Model.IsDeprecated}" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<StackPanel Orientation="Horizontal" Margin="1" Width="450">
<StackPanel Orientation="Horizontal">
<Button Name="DownloadButton" Style="{StaticResource FlatButton}" Command="{Binding DownloadLatestCommand }" Foreground="#888"
ToolTip="{x:Static p:Resources.PackageSearchViewInstallLatestVersion}">
<Grid Width="40" Height="64">
<TextBlock IsHitTestVisible="True" Background="Transparent" FontSize="30" Padding="12">⬇</TextBlock>
<Ellipse Fill="Transparent"
Height="36"
Width="36"
StrokeThickness="3"
Stroke="#666" />
</Grid>
</Button>
<Button Name="DownloadButtonDropDown" Style="{StaticResource FlatButton}" Click="OnInstallLatestButtonDropDownClicked" Foreground="#888">
<Grid Width="10" Height="64" Background="Transparent" >
<TextBlock IsHitTestVisible="True" Background="Transparent" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center">▾</TextBlock>
</Grid>
<Button.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.PackageSearchViewInstallLatestVersion}"
Command="{Binding DownloadLatestCommand}" />
<MenuItem Header="{x:Static p:Resources.PackageSearchViewInstallLatestVersionTo}"
Command="{Binding DownloadLatestToCustomPathCommand}"
CommandParameter="{Binding Path=Model.LatestVersion}"/>
</ContextMenu>
</Button.ContextMenu>
</Button>
</StackPanel>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource FlatButton}" Command="{Binding ToggleIsExpandedCommand }" Background="#333">
<StackPanel Width="340" IsHitTestVisible="True" >
<TextBlock FontSize="14" Name="name" Text="{Binding Path=Model.Name}" Margin="5,0,0,0" HorizontalAlignment="Left" Foreground="WhiteSmoke" />
<StackPanel Orientation="Horizontal" Margin="0,6,0,2">
<StackPanel Orientation="Horizontal" Margin="5" Width="100">
<TextBlock FontSize="10" FontWeight="Bold" Text="✎ " Foreground="Gray" />
<TextBlock FontSize="10" MaxWidth="100" Text="{Binding Path= Model.Maintainers}" TextTrimming="WordEllipsis" Foreground="Gray" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5" Width="60">
<TextBlock FontSize="10" FontWeight="Bold" Text="⚑ " Foreground="Gray" />
<TextBlock FontSize="10" Text="{Binding Path= Model.LatestVersion}" Foreground="Gray" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5" Width="50">
<TextBlock FontSize="10" FontWeight="Bold" Text="▼ " Foreground="Gray" />
<TextBlock FontSize="10" Text="{Binding Path= Model.Downloads}" Foreground="Gray" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5" Width="80">
<TextBlock FontSize="10" FontWeight="Bold" Text="◷ " Foreground="Gray" />
<TextBlock FontSize="10" Text="{Binding Path= Model.LatestVersionCreated, Converter={StaticResource PrettyDateConverter}}" Foreground="Gray" />
</StackPanel>
</StackPanel>
</StackPanel>
</Button>
<StackPanel Width="40" Orientation="Vertical" Margin="3,0,0,0">
<StackPanel Orientation="Horizontal">
<Button Name="UpvoteButton"
FontSize="15"
ToolTip="{x:Static p:Resources.PackageSearchViewUpvoteButtonTooltip}"
Content="⬆"
Margin="0,0,8,0"
Foreground="Gray"
Command="{Binding Path=UpvoteCommand}"
Style="{StaticResource FlatButton}" />
<Button Name="DownvoteButton"
FontSize="15"
ToolTip="{x:Static p:Resources.PackageSearchViewDownvoteButtonTooltip}"
Foreground="Gray"
Content="⬇"
Command="{Binding Path=DownvoteCommand}"
Style="{StaticResource FlatButton}" />
</StackPanel>
<TextBlock FontSize="10" TextAlignment="Center" Margin="0,0,5,0" Text="{Binding Path=Model.Votes}" Foreground="Gray" />
</StackPanel>
</StackPanel>
<Button Style="{StaticResource FlatButton}" Command="{Binding ToggleIsExpandedCommand }" Background="#333">
<TextBlock FontSize="11" Margin="3" Width="390" Foreground="#AAA" Text="{Binding Path=Model.Description}" TextWrapping="Wrap" TextTrimming="WordEllipsis" MaxHeight="20"/>
</Button>
</StackPanel>
</StackPanel>
<StackPanel Visibility="{Binding Path= Model.IsExpanded, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" Background="#222">
<TextBlock FontSize="11" FontWeight="Bold" Text="{x:Static p:Resources.PackageSearchViewDescription}" Foreground="WhiteSmoke" Padding="10,10,0,0"/>
<TextBlock FontSize="11" Foreground="WhiteSmoke" Text="{Binding Path=Model.Description}" TextWrapping="Wrap" Margin="10,10,10,0" />
<StackPanel Orientation="Horizontal" Margin="10,10,0,0" Visibility="{Binding Path=Model.Keywords, Converter={StaticResource EmptyStringToCollapsedConverter}}">
<TextBlock FontSize="11" FontWeight="Bold" Text="{x:Static p:Resources.PackageSearchViewKeywords}" Foreground="WhiteSmoke" Padding="0,0,5,0"/>
<TextBlock FontSize="11" Text="{Binding Path=Model.Keywords}" Foreground="WhiteSmoke" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="10,10,0,10">
<TextBlock FontSize="11" FontWeight="Bold" Text="{x:Static p:Resources.PackageSearchViewVersions}" Foreground="WhiteSmoke" Padding="0,0,5,0"/>
<ItemsControl Name="Versions" ItemsSource="{Binding Path=Versions}" BorderThickness="0" Padding="0" Margin="10,0,0,0" Background="Transparent" >
<ItemsControl.ItemTemplate >
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Item1.version}" MinWidth="50" Margin="5" Foreground="WhiteSmoke" />
<TextBlock Text="{Binding Path=Item1.created, Converter={StaticResource PrettyDateConverter}}" MinWidth="100" Margin="24,5,5,5" Foreground="DarkGray" />
<Border Background="#000000" Margin="3">
<StackPanel Orientation="Horizontal">
<Button Name="DownloadVersionButtonText"
Style="{StaticResource DownloadVersionButton}"
ToolTip="{x:Static p:Resources.PackageSearchViewInstallThisVersion}"
Content="{x:Static p:Resources.PackageSearchViewInstallButton}"
Command="{Binding Path=Item2}"
CommandParameter="false" />
<Button Name="DownloadVersionButtonDropDown"
Style="{StaticResource DownloadVersionButton}"
Content="▾"
Click="OnInstallVersionButtonDropDownClicked">
<Button.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static p:Resources.PackageSearchViewInstallThisVersion}"
Command="{Binding Path=Item2}"
CommandParameter="false"/>
<MenuItem Header="{x:Static p:Resources.PackageSearchViewInstallThisVersionTo}"
Command="{Binding Path=Item2}"
CommandParameter="true"/>
</ContextMenu>
</Button.ContextMenu>
</Button>
</StackPanel>
</Border>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
<Button Name="SiteButton" Content="{x:Static p:Resources.PackageSearchViewVisitWebSiteButton}" Visibility="{Binding Path=Model.SiteUrl, Converter={StaticResource EmptyStringToCollapsedConverter}}" Command="{Binding Path=VisitSiteCommand}" Style="{StaticResource SBadgeButton}" />
<Button Name="RepositoryButton" Content="{x:Static p:Resources.PackageSearchViewVisitRepositoryBuutton}" Visibility="{Binding Path=Model.RepositoryUrl, Converter={StaticResource EmptyStringToCollapsedConverter}}" Command="{Binding Path=VisitRepositoryCommand}" Style="{StaticResource SBadgeButton}" />
</StackPanel>
</StackPanel>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<GridSplitter ResizeDirection="Rows"
Grid.Row="2"
Grid.RowSpan="1"
Width="Auto"
Height="2"
HorizontalAlignment="Stretch"
Margin="0"
Background="#333"/>
<Grid Grid.Row="3" Background="Black" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MaxHeight="200"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Name="Controls" Grid.Row="1" Orientation="Horizontal" FlowDirection="RightToLeft" Background="#222" Visibility="{Binding Path=HasDownloads, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}">
<Button Name="ClearCompletedButton"
Margin="1, 0, 1, 0"
ToolTip="{x:Static p:Resources.PackageSearchViewClearButtonTooltip}"
Content="{x:Static p:Resources.PackageSearchViewClearButton}"
Style="{DynamicResource SBadgeButton}" Command="{Binding Path=ClearCompletedCommand}"/>
</StackPanel>
<ScrollViewer HorizontalAlignment="Stretch" Margin="0" Name="ScrollView" VerticalAlignment="Stretch" Focusable="False"
VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Hidden" Background="Black" BorderThickness="0" Width="{Binding Path=ActualWidth,ElementName=RSearchBoxStackPanel}" Grid.Column="0" Grid.ColumnSpan="1" Grid.Row="0" >
<ListBox Name="DownloadsListBox" ItemsSource="{Binding Path=Downloads}" BorderThickness="0" Padding="0" Background="Black" >
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
Color="#FFF"/>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}"
Color="#FFF" />
</Style.Resources>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate >
<DataTemplate>
<Border BorderBrush="DimGray" BorderThickness="0,0,0,1">
<StackPanel Orientation="Horizontal" Name="SearchEle" >
<StackPanel Width ="270" >
<TextBlock FontSize="14" Name="name" Text="{Binding Path=Name}" Foreground="White" Padding="5"/>
<TextBlock FontSize="10" Name="error" Text="{Binding Path=ErrorString}" Foreground="White" Padding="5"/>
</StackPanel>
<StackPanel Width ="172" >
<TextBlock FontSize="11" Name="downloadState" Text="{Binding Path=DownloadState, Converter={StaticResource PackageDownloadStateToStringConverter}}" Foreground="White" Padding="5"/>
<TextBlock FontSize="11" Name="version" Text="{Binding Path=VersionName}" Foreground="White" Padding="5"/>
</StackPanel>
</StackPanel>
</Border>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="Unknown">
<DataTrigger.Setters>
<Setter Property="Background" Value="#CC000000" TargetName="SearchEle" />
</DataTrigger.Setters>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="Downloaded">
<DataTrigger.Setters>
<Setter Property="Background" Value="Gray" TargetName="SearchEle" />
</DataTrigger.Setters>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="Downloading">
<DataTrigger.Setters>
<Setter Property="Background" Value="Gray" TargetName="SearchEle" />
</DataTrigger.Setters>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="Error">
<DataTrigger.Setters>
<Setter Property="Background" Value="LightCoral" TargetName="SearchEle" />
</DataTrigger.Setters>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="Installed">
<DataTrigger.Setters>
<Setter Property="Background" Value="LightBlue" TargetName="SearchEle" />
</DataTrigger.Setters>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="Installing">
<DataTrigger.Setters>
<Setter Property="Background" Value="Gray" TargetName="SearchEle" />
</DataTrigger.Setters>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
</Grid>
</Grid>
</Window>