-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMainWindow.xaml
579 lines (545 loc) · 39.4 KB
/
MainWindow.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
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
<Window x:Class="FFBitrateViewer.MainWindow"
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:oxySkia="clr-namespace:OxyPlot.SkiaSharp.Wpf;assembly=OxyPlot.SkiaSharp.Wpf"
xmlns:local="clr-namespace:FFBitrateViewer"
xmlns:uc="clr-namespace:FFBitrateViewer.UserControls"
xmlns:utils="clr-namespace:Utilities"
mc:Ignorable="d"
Height="720" MinHeight="600"
Width="1280" MinWidth="940"
Loaded="Window_Loaded" ResizeMode="CanResizeWithGrip"
Title="{Binding Path=WindowTitle}"
>
<Window.InputBindings>
<KeyBinding Command="{Binding Path=ExecStartCmd}" Key="F9"/>
<KeyBinding Command="{Binding Path=ExecStopCmd}" Key="Esc"/>
<KeyBinding Command="{Binding Path=FilesAddCmd}" Key="O" Modifiers="Ctrl"/>
<KeyBinding Command="{Binding Path=FilesRemoveCmd}" Key="DEL"/>
<KeyBinding Command="{Binding Path=MediaInfoReloadCmd}" Key="F5"/>
<KeyBinding Command="{Binding Path=PlotExportToClipboardCmd}" Key="C" Modifiers="Ctrl"/>
<KeyBinding Command="{Binding Path=PlotExportToFileCmd}" Key="S" Modifiers="Ctrl"/>
<KeyBinding Command="{Binding Path=ResetAllCmd}" Key="W" Modifiers="Ctrl"/>
</Window.InputBindings>
<Window.Resources>
<local:BindingProxy x:Key="proxy" Data="{Binding}" />
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
<local:BitRateConverter x:Key="BitRate" />
<local:BitrateFilledToBooleanConverter x:Key="BitRateFilledToBoolean" />
<local:FileDropTargetBackgroundConverter x:Key="FileDropTargetBackground" />
<local:FileDurationConverter x:Key="FileDuration" />
<local:FramesCountConverter x:Key="FramesCount" />
<local:FSConverter x:Key="FS" />
<local:InverseBooleanConverter x:Key="InverseBoolean" />
<local:MediaInfoCompactConverter x:Key="MediaInfoFrameInfoCompact" />
<local:NotNullToVisibileConverter x:Key="NotNullVisible" />
<local:StringToBooleanConverter x:Key="StringToBoolean" />
<Style TargetType="{x:Type ContentControl}">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="FFProbeValidity" TargetType="{x:Type StatusBarItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding VersionInfo.IsOK}" Value="False">
<Setter Property="Control.Foreground" Value="Red" />
<Setter Property="Control.FontWeight" Value="Bold" />
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="FileProgressBar" TargetType="{x:Type ProgressBar}">
<Setter Property="Foreground" Value="#FF08DE2F" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0,0,0,0" />
</Style>
<Style x:Key="BitrateContent" TargetType="{x:Type TextBox}">
<Setter Property="Padding" Value="0,1" />
<Setter Property="IsReadOnly" Value="True" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontSize" Value="13" />
</Style>
<Style x:Key="BitrateAvgContent" TargetType="{x:Type TextBox}">
<Setter Property="Padding" Value="0,1" />
<Setter Property="IsReadOnly" Value="True" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontSize" Value="13" />
<Style.Triggers>
<DataTrigger Binding="{Binding Path=BitRateAvg, Converter={StaticResource BitRateFilledToBoolean}}" Value="True">
<Setter Property="Control.FontWeight" Value="Bold" />
</DataTrigger>
</Style.Triggers>
</Style>
<!-- ListViewItem ControlTemplate -->
<!--
Re-defining ListViewItem ControlTemplate as we need "drop to" indicator between items
Styling it similar to default implementation: https://github.com/dotnet/wpf/blob/main/src/Microsoft.DotNet.Wpf/src/Themes/XAML/ListViewItem.xaml
-->
<Style x:Key="ListViewItemFocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle StrokeThickness="1" RadiusX="2" RadiusY="2" Stroke="#8E6EA6F5"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<LinearGradientBrush x:Key="ListItemHoverFill" StartPoint="0,0" EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="#FFF1FBFF" Offset="0"/>
<GradientStop Color="#FFD5F1FE" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="ListItemSelectedFill" StartPoint="0,0" EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="#FFD9F4FF" Offset="0"/>
<GradientStop Color="#FF9BDDFB" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="ListItemSelectedHoverFill" StartPoint="0,0" EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="#FFEAF9FF" Offset="0"/>
<GradientStop Color="#FFC9EDFD" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="ListItemSelectedInactiveFill" StartPoint="0,0" EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="#FFEEEDED" Offset="0"/>
<GradientStop Color="#FFDDDDDD" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<Style x:Key="GridViewItemContainerStyleKey" TargetType="{x:Type ListViewItem}">
<Setter Property="FocusVisualStyle" Value="{StaticResource ListViewItemFocusVisual}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="0,0,0,1"/>
<Setter Property="Padding" Value="5,2,5,2"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Border Name="OuterBorder" Grid.Row="0" Grid.RowSpan="2" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" CornerRadius="2" SnapsToDevicePixels="true">
<Border Name="InnerBorder" CornerRadius="1" BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition MaxHeight="11"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Rectangle Name="UpperHighlight" Visibility="Collapsed" Fill="#75FFFFFF"/>
<GridViewRowPresenter Grid.RowSpan="2" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Grid>
</Border>
</Border>
<Border Grid.Row="0" Visibility="Hidden" BorderBrush="Transparent" Margin="0,-1,0,0" BorderThickness="0,2,0,0" Name="DropAbove"/>
<Border Grid.Row="1" Visibility="Hidden" BorderBrush="Transparent" Margin="0,0,0,-1" BorderThickness="0,0,0,2" Name="DropBelow"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource ListItemHoverFill}"/>
<Setter Property="BorderBrush" Value="#FFCCF0FF"/>
<Setter TargetName="UpperHighlight" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{StaticResource ListItemSelectedFill}"/>
<Setter Property="BorderBrush" Value="#FF98DDFB"/>
<Setter TargetName="InnerBorder" Property="BorderBrush" Value="#80FFFFFF"/>
<Setter TargetName="UpperHighlight" Property="Visibility" Value="Visible"/>
<Setter TargetName="UpperHighlight" Property="Fill" Value="#40FFFFFF"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True"/>
<Condition Property="Selector.IsSelectionActive" Value="False"/>
</MultiTrigger.Conditions>
<Setter Property="Background" Value="{StaticResource ListItemSelectedInactiveFill}"/>
<Setter Property="BorderBrush" Value="#FFCFCFCF"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True"/>
<Condition Property="IsMouseOver" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Background" Value="{StaticResource ListItemSelectedHoverFill}"/>
<Setter Property="BorderBrush" Value="#FF98DDFB"/>
</MultiTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
<Trigger Property="utils:DragDropHighlighter.IsDroppingAbove" Value="True">
<Setter TargetName="DropAbove" Property="Visibility" Value="Visible"/>
<Setter TargetName="DropAbove" Property="BorderBrush" Value="Black"/>
</Trigger>
<Trigger Property="utils:DragDropHighlighter.IsDroppingBelow" Value="True">
<Setter TargetName="DropBelow" Property="Visibility" Value="Visible"/>
<Setter TargetName="DropBelow" Property="BorderBrush" Value="Black"/>
</Trigger>
<DataTrigger Binding="{Binding Path=IsEnabled}" Value="False">
<Setter Property="Opacity" Value="0.5" TargetName="OuterBorder"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsExists}" Value="False">
<Setter Property="Foreground" Value="Red" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
</Style.Triggers>
</Style>
<!-- /ListViewItem ControlTemplate -->
</Window.Resources>
<Window.TaskbarItemInfo>
<TaskbarItemInfo ProgressState="Normal" ProgressValue="{Binding Path=OverallProgress.CurrentPercent, Mode=OneWay}" />
</Window.TaskbarItemInfo>
<Grid x:Name="GridTop">
<Grid.RowDefinitions>
<RowDefinition Height="22"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="25"></RowDefinition>
</Grid.RowDefinitions>
<Menu Grid.Row="0" FontSize="14" Padding="5,0,0,0">
<MenuItem Header="_File">
<MenuItem Header="E_xit" Command="{Binding ExitCmd}" InputGestureText="Alt+F4">
<MenuItem.Icon>
<ContentControl Template="{StaticResource ExitIcon}" />
</MenuItem.Icon>
</MenuItem>
</MenuItem>
<MenuItem Header="A_ctions">
<MenuItem Header="_Add files…" Command="{Binding Path=FilesAddCmd}" InputGestureText="Ctrl+O">
<MenuItem.Icon>
<ContentControl Template="{StaticResource OpenFileIcon}" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="_Remove selected files" Command="{Binding Path=FilesRemoveCmd}" InputGestureText="DEL">
<MenuItem.Icon>
<ContentControl Template="{StaticResource DeleteTableRowIcon}" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Remove ALL files" Command="{Binding Path=FilesClearCmd}">
<MenuItem.Icon>
<ContentControl Template="{StaticResource DeleteAllRowsIcon}" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="Refresh _media info" Command="{Binding Path=MediaInfoReloadCmd}" InputGestureText="F5">
<MenuItem.Icon>
<ContentControl Template="{StaticResource RefreshIcon}" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="_Start" Command="{Binding ExecStartCmd}" InputGestureText="F9">
<MenuItem.Icon>
<ContentControl Template="{StaticResource StartIcon}" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="St_op" Command="{Binding ExecStopCmd}" InputGestureText="Esc">
<MenuItem.Icon>
<ContentControl Template="{StaticResource StopIcon}" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="_Reset ALL results" Command="{Binding Path=ResetAllCmd}" InputGestureText="Ctrl+W">
<MenuItem.Icon>
<ContentControl Template="{StaticResource CleanDataIcon}" />
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="Copy plot to _clipboard" Command="{Binding PlotExportToClipboardCmd}" InputGestureText="Ctrl+C">
<MenuItem.Icon>
<ContentControl Template="{StaticResource CopyThemeIcon}" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save plot to _file…" Command="{Binding PlotExportToFileCmd}" InputGestureText="Ctrl+S">
<MenuItem.Icon>
<ContentControl Template="{StaticResource ImportThemeIcon}" />
</MenuItem.Icon>
</MenuItem>
</MenuItem>
<MenuItem Header="_Options">
<MenuItem Header="Write _FFProbe commands to log" IsCheckable="True" IsChecked="{Binding Path=IsLoggingFFCommands}" IsEnabled="{Binding Path=IsLogCommandsEnabled}"></MenuItem>
</MenuItem>
<MenuItem Header="_Help">
<MenuItem Header="_About" Command="{Binding AboutShowCmd}"></MenuItem>
</MenuItem>
</Menu>
<Grid Grid.Row="1" x:Name="GridContent" IsEnabled="{Binding Path=VersionInfo.IsOK}">
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="160"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="25"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="90"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.ColumnSpan="3" Orientation="Horizontal" Height="25" VerticalAlignment="Top" Margin="15,15,15,0">
<Button Command="{Binding FilesAddCmd}" Margin="0" Height="25" FontSize="14" ToolTip="Add files to the list" HorizontalContentAlignment="Left" AllowDrop="False">
<StackPanel Orientation="Horizontal">
<ContentControl Template="{StaticResource OpenFileIcon}" Margin="5,0,5,0" />
<TextBlock Margin="0,0,5,0">Add files…</TextBlock>
</StackPanel>
</Button>
<Button Command="{Binding FilesRemoveCmd}" Margin="10,0,0,0" Height="25" FontSize="14" ToolTip="Remove selected files from the list" HorizontalContentAlignment="Left" AllowDrop="False">
<StackPanel Orientation="Horizontal">
<ContentControl Template="{StaticResource DeleteTableRowIcon}" Margin="5,0,5,0" />
<TextBlock Margin="0,0,10,0">Remove selected</TextBlock>
</StackPanel>
</Button>
</StackPanel>
<Grid Grid.Row="1" Grid.ColumnSpan="3" x:Name="FilesList" Margin="15,5,15,0" IsEnabled="{Binding Path=IsRunning, Mode=OneWay, Converter={StaticResource InverseBoolean}}" VirtualizingStackPanel.IsVirtualizing="False">
<ListView x:Name="listviewFiles" FontSize="14"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
AllowDrop="True"
PreviewDragEnter="Control_PreviewDragEnter"
PreviewDragLeave="Control_PreviewDragLeave"
PreviewDragOver="Control_PreviewDragOver"
PreviewDrop="Control_PreviewDrop"
PreviewMouseLeftButtonDown="Control_PreviewMouseLeftButtonDown"
MouseMove="Control_MouseMove"
ItemsSource="{Binding Path=Files}" Margin="0,0,0,0"
ItemContainerStyle="{StaticResource GridViewItemContainerStyleKey}"
>
<ListView.Resources>
<Style TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="HorizontalContentAlignment" Value="Left" />
</Style>
</ListView.Resources>
<ListView.View>
<GridView AllowsColumnReorder="False">
<GridViewColumn Header="" Width="20" x:Name="GridViewColCheckbox">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Path=IsEnabled}" Padding="0" Margin="-5,0" VerticalContentAlignment="Center" ToolTip="Only ticked files processed and shown on plot" VerticalAlignment="Center" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="" Width="20" x:Name="GridViewColPlayButton">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button IsEnabled="{Binding Path=IsPreviewable, Mode=OneWay}" Padding="0" Margin="-5,0" VerticalContentAlignment="Center" VerticalAlignment="Center" Background="White" BorderBrush="White"
ToolTip="Play media with associated system player" Command="{Binding Source={StaticResource proxy}, Path=Data.PlayMediaCmd}" CommandParameter="{Binding Path=FS}"
>
<ContentControl Template="{StaticResource StartIcon}" />
</Button>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header=" Path to file" Width="{Binding ElementName=helperField, Path=ActualWidth, Mode=OneWay}" x:Name="GridViewColPath">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=FS, Mode=OneWay, Converter={StaticResource FS}}" ToolTip="{Binding Path=FS, Mode=OneWay}" FontSize="13" Padding="0" Margin="-5,0" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header=" Media info" Width="140" x:Name="GridViewColMediaInfo">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid Margin="-5,0" Width="{Binding ElementName=GridViewColMediaInfo, Path=ActualWidth, Mode=OneWay}">
<!-- ProgressBar with IsIndeterminate="True" causing high CPU/GPU utilisation even when hidden! -->
<ProgressBar Style="{StaticResource FileProgressBar}" IsIndeterminate="{Binding Path=IsMediaInfoLoading, Mode=OneWay}" Visibility="{Binding Path=IsMediaInfoLoading, Mode=OneWay, Converter={StaticResource BoolToVisibility}}"/>
<Label VerticalContentAlignment="Center" Padding="0" FontSize="13"
Content="{Binding Path=MediaInfo, Mode=OneWay, Converter={StaticResource MediaInfoFrameInfoCompact}}"
ToolTipService.ShowDuration="20000"
>
<Label.ToolTip>
<ToolTip Visibility="{Binding Path=MediaInfo, Mode=OneWay, Converter={StaticResource NotNullVisible}}">
<uc:MediaInfoBox MediaInfo="{Binding Path=MediaInfo, Mode=OneWay}" FramesCount="{Binding Path=FramesCount, Mode=OneWay}" />
</ToolTip>
</Label.ToolTip>
</Label>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header=" Duration" Width="65" x:Name="GridViewColDuration">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid Margin="-2,0" Width="{Binding ElementName=GridViewColDuration, Path=ActualWidth, Mode=OneWay}" HorizontalAlignment="Right">
<TextBlock Text="{Binding Path=Duration, Mode=OneWay, Converter={StaticResource FileDuration}}" FontSize="13" VerticalAlignment="Center" TextAlignment="Right" />
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header=" Frames" Width="65" x:Name="GridViewColFrames">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid Margin="-2,0" Width="{Binding ElementName=GridViewColFrames, Path=ActualWidth, Mode=OneWay}" HorizontalAlignment="Right">
<TextBlock Text="{Binding Path=FramesCount, Mode=OneWay, Converter={StaticResource FramesCount}}" FontSize="13" VerticalAlignment="Center" TextAlignment="Right" HorizontalAlignment="Right" />
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header=" Avg bit rate" Width="90" x:Name="GridViewColBitRateAvg">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid Margin="-2,0" Width="{Binding ElementName=GridViewColBitRateAvg, Path=ActualWidth, Mode=OneWay}" HorizontalAlignment="Right">
<!-- ProgressBar with IsIndeterminate="True" causing high CPU/GPU utilisation even when hidden! -->
<ProgressBar Style="{StaticResource FileProgressBar}" IsIndeterminate="{Binding Path=IsFramesLoading, Mode=OneWay}" Visibility="{Binding Path=IsFramesLoading, Mode=OneWay, Converter={StaticResource BoolToVisibility}}"/>
<TextBox Text="{Binding Path=BitRateAvg, Mode=OneWay, Converter={StaticResource BitRate}}" Style="{StaticResource BitrateAvgContent}" FontSize="13" VerticalAlignment="Center" HorizontalAlignment="Right"
GotFocus="TextBox_GotFocus" LostFocus="TextBox_LostFocus" PreviewMouseUp="TextBox_PreviewMouseUp"
/>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header=" Min bit rate" Width="85" x:Name="GridViewColBitRateMin">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid Margin="-2,0" Width="{Binding ElementName=GridViewColBitRateMin, Path=ActualWidth, Mode=OneWay}" HorizontalAlignment="Right">
<!-- ProgressBar with IsIndeterminate="True" causing high CPU/GPU utilisation even when hidden! -->
<ProgressBar Style="{StaticResource FileProgressBar}" IsIndeterminate="{Binding Path=IsFramesLoading, Mode=OneWay}" Visibility="{Binding Path=IsFramesLoading, Mode=OneWay, Converter={StaticResource BoolToVisibility}}"/>
<TextBox Text="{Binding Path=BitRateMin, Mode=OneWay, Converter={StaticResource BitRate}}" Style="{StaticResource BitrateContent}" FontSize="13" VerticalAlignment="Center" HorizontalAlignment="Right"
GotFocus="TextBox_GotFocus" LostFocus="TextBox_LostFocus" PreviewMouseUp="TextBox_PreviewMouseUp"
/>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header=" Max bit rate" Width="85" x:Name="GridViewColBitRateMax">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid Margin="-2,0" Width="{Binding ElementName=GridViewColBitRateMax, Path=ActualWidth, Mode=OneWay}" HorizontalAlignment="Right">
<!-- ProgressBar with IsIndeterminate="True" causing high CPU/GPU utilisation even when hidden! -->
<ProgressBar Style="{StaticResource FileProgressBar}" IsIndeterminate="{Binding Path=IsFramesLoading, Mode=OneWay}" Visibility="{Binding Path=IsFramesLoading, Mode=OneWay, Converter={StaticResource BoolToVisibility}}"/>
<TextBox Text="{Binding Path=BitRateMax, Mode=OneWay, Converter={StaticResource BitRate}}" Style="{StaticResource BitrateContent}" FontSize="13" VerticalAlignment="Center" HorizontalAlignment="Right"
GotFocus="TextBox_GotFocus" LostFocus="TextBox_LostFocus" PreviewMouseUp="TextBox_PreviewMouseUp"
/>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<!-- This is the hidden helper Grid which does the resizing -->
<!-- https://stackoverflow.com/questions/10309249/listview-gridviewcolumn-width -->
<Grid Visibility="Hidden">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding ElementName=GridViewColCheckbox, Path=ActualWidth, Mode=OneWay}"/>
<ColumnDefinition Width="{Binding ElementName=GridViewColPlayButton, Path=ActualWidth, Mode=OneWay}"/>
<!-- Width is set to "Fill" -->
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="{Binding ElementName=GridViewColMediaInfo, Path=ActualWidth, Mode=OneWay}"/>
<ColumnDefinition Width="{Binding ElementName=GridViewColDuration, Path=ActualWidth, Mode=OneWay}"/>
<ColumnDefinition Width="{Binding ElementName=GridViewColFrames, Path=ActualWidth, Mode=OneWay}"/>
<ColumnDefinition Width="{Binding ElementName=GridViewColBitRateAvg, Path=ActualWidth, Mode=OneWay}"/>
<ColumnDefinition Width="{Binding ElementName=GridViewColBitRateMin, Path=ActualWidth, Mode=OneWay}"/>
<ColumnDefinition Width="{Binding ElementName=GridViewColBitRateMax, Path=ActualWidth, Mode=OneWay}"/>
<!--Correction Width-->
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="2" x:Name="helperField" Background="Aqua"/>
</Grid>
</Grid>
<StackPanel Grid.Row="2" Grid.ColumnSpan="3" Orientation="Horizontal" Height="35" VerticalAlignment="Top" Margin="15,15,15,0" IsEnabled="{Binding Path=VersionInfo.IsOK}">
<Button Width="90" FontSize="18" FontWeight="Bold" Command="{Binding Path=ExecToggleCmd}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="1,1,1,2" HorizontalAlignment="Left" Background="#FFDDDDDD">
<Button.Resources>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsRunning, Mode=OneWay}" Value="True">
<Setter Property="ToolTip" Value="Stop"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsRunning, Mode=OneWay}" Value="False">
<Setter Property="ToolTip" Value="Start"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Resources>
<StackPanel Orientation="Horizontal" Margin="-5,0,0,0">
<Viewbox Width="24" Height="24">
<ContentControl>
<ContentControl.Resources>
<Style TargetType="{x:Type ContentControl}">
<Setter Property="Template" Value="{StaticResource StartIcon}" />
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsRunning, Mode=OneWay}" Value="True">
<Setter Property="Template" Value="{StaticResource StopIcon}" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Resources>
</ContentControl>
</Viewbox>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Padding="0,0,0,1">
<TextBlock.Resources>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsRunning, Mode=OneWay}" Value="True">
<Setter Property="Text" Value="Stop" />
<Setter Property="ToolTip" Value="Stop (Esc)" />
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsRunning, Mode=OneWay}" Value="False">
<Setter Property="Text" Value="Start" />
<Setter Property="ToolTip" Value="Start (F9)" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Resources>
</TextBlock>
</StackPanel>
</Button>
<StackPanel Orientation="Horizontal" IsEnabled="{Binding Path=IsRunning, Converter={StaticResource InverseBoolean}}">
<Button Width="90" FontSize="18" Margin="10,0,0,0" Command="{Binding Path=ResetAllCmd}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" ToolTip="Reset ALL frames">
<StackPanel Orientation="Horizontal" Margin="0,-1,0,0">
<Viewbox Width="24" Height="24">
<ContentControl Template="{StaticResource CleanDataIcon}" />
</Viewbox>
<TextBlock Margin="5,0,5,0">Reset</TextBlock>
</StackPanel>
</Button>
<Label VerticalContentAlignment="Center" FontSize="14" Margin="50,0,0,2">Plot view:</Label>
<RadioButton GroupName="PlotViewType" Margin="5,0,0,0" IsChecked="{Binding Path=PlotViewType, ConverterParameter='frame', Converter={StaticResource StringToBoolean}, Mode=TwoWay}" VerticalContentAlignment="Center">
<TextBlock Margin="-2,0,0,0" FontSize="14">Frame based</TextBlock>
</RadioButton>
<RadioButton GroupName="PlotViewType" Margin="10,0,0,0" IsChecked="{Binding Path=PlotViewType, ConverterParameter='second', Converter={StaticResource StringToBoolean}, Mode=TwoWay}" VerticalContentAlignment="Center">
<TextBlock Margin="-2,0,0,0" FontSize="14">Second based</TextBlock>
</RadioButton>
<RadioButton GroupName="PlotViewType" Margin="10,0,0,0" IsChecked="{Binding Path=PlotViewType, ConverterParameter='GOP', Converter={StaticResource StringToBoolean}, Mode=TwoWay}" VerticalContentAlignment="Center">
<TextBlock Margin="-2,0,0,0" FontSize="14">GOP based</TextBlock>
</RadioButton>
<CheckBox Margin="50,0,0,0" VerticalContentAlignment="Center" IsChecked="{Binding Path=IsAdjustStartTimeOnPlot, Mode=TwoWay}" ToolTip="Use file/stream start time to adjust frames start time on plot">
<TextBlock FontSize="14">Adjust frames start time</TextBlock>
</CheckBox>
</StackPanel>
</StackPanel>
<Grid Grid.Row="3" Grid.ColumnSpan="3" x:Name="Plot" Margin="0,5,0,0">
<oxySkia:PlotView Model="{Binding Path=PlotModel}" Controller="{Binding Path=PlotModel.Controller}" Padding="0,1,0,0" Margin="0" />
</Grid>
<Grid Grid.Row="4" Grid.ColumnSpan="3">
<TextBlock VerticalAlignment="Center" Margin="10,0,10,2" FontSize="14" ScrollViewer.VerticalScrollBarVisibility="Hidden">
<Bold>Zoom:</Bold> mouse wheel over plot/axes <Italic>or</Italic> +/- keys
<Span> </Span>
<Bold>Pan:</Bold> drag with right mouse button <Italic>or</Italic> hold Alt and drag with left mouse button <Italic>or</Italic> arrow keys.
</TextBlock>
</Grid>
</Grid>
<StatusBar Grid.Row="2" Height="25" VerticalAlignment="Bottom" Margin="0" VerticalContentAlignment="Stretch" Padding="5,0,20,1" HorizontalContentAlignment="Stretch" UseLayoutRounding="True">
<StatusBarItem DockPanel.Dock="Right" VerticalAlignment="Center">
<Grid Width="260" Height="21" VerticalAlignment="Center">
<!-- ProgressBar with IsIndeterminate="True" causing high CPU/GPU utilisation even when hidden! -->
<ProgressBar Height="17" Minimum="0" Maximum="{Binding Path=OverallProgress.Max, Mode=OneWay}" Value="{Binding Path=OverallProgress.Current, Mode=OneWay}" Visibility="{Binding Path=OverallProgress.IsActive, Converter={StaticResource BoolToVisibility}}" IsIndeterminate="{Binding Path=OverallProgress.IsIndeterminateXAML}" VerticalAlignment="Center" />
<TextBlock FontSize="12" Margin="4,0,4,0" Text="{Binding Path=OverallProgress.Text, Mode=OneWay}" VerticalAlignment="Center" Foreground="Black"/>
</Grid>
</StatusBarItem>
<StatusBarItem Padding="0" Content="FFProbe:" FontSize="14" Margin="3,0,0,0"></StatusBarItem>
<StatusBarItem Padding="0" FontSize="14" Margin="5,0,15,0" Content="{Binding Path=VersionInfo.VerString, Mode=OneWay}" ToolTip="{Binding VersionInfo.InfoString, Mode=OneWay}" Style="{StaticResource FFProbeValidity}" />
</StatusBar>
</Grid>
</Window>