Skip to content

Instantly share code, notes, and snippets.

@ChuckSavage
Created March 19, 2022 17:47
Show Gist options
  • Save ChuckSavage/dfc0d584069c683abcffb9380895fe1d to your computer and use it in GitHub Desktop.
Save ChuckSavage/dfc0d584069c683abcffb9380895fe1d to your computer and use it in GitHub Desktop.
play symbol for video files
<UserControl xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SeaRisen.SFFv2"
xmlns:c="clr-namespace:SeaRisen.SFFv2.Converters"
xmlns:misc="clr-namespace:SeaRisen.SFFv2.Misc"
xmlns:zoom="clr-namespace:ZoomAndPan;assembly=ZoomAndPan"
xmlns:settings="clr-namespace:SeaRisen.SFFv2.Files.Xml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:imaging="clr-namespace:SeaRisenLib2.Imaging;assembly=SeaRisenLib2"
xmlns:swpf="clr-namespace:SeaRisenLib2.WPF;assembly=SeaRisenLib2"
xmlns:flib="clr-namespace:SeaRisen.FrameITLib;assembly=FrameITLib"
xmlns:menu="clr-namespace:SeaRisen.SFFv2.Menus"
xmlns:gif="http://wpfanimatedgif.codeplex.com"
x:Class="SeaRisen.SFFv2.TileLoader"
x:Name="_this"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
PreviewMouseDown="Preview_OnMouseDown"
>
<UserControl.Resources>
<ResourceDictionary>
<!--
<Viewbox x:Key="PlaySymbol"
x:Shared="False"
Stretch="Uniform"
RenderTransformOrigin="0.5,0.5"
Opacity="0.75"
>
<Viewbox.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.5" ScaleY="0.5"/>
</TransformGroup>
</Viewbox.RenderTransform>
<ContentControl Content="{StaticResource appbar_control_play}" />
</Viewbox>
-->
<Style x:Key="MenuItemContainerStyle" TargetType="telerik:RadMenuItem">
<Setter Property="Header" Value="{Binding Text}"/>
<Setter Property="ItemsSource" Value="{Binding SubItems}"/>
<Setter Property="IsEnabled" Value="{Binding IsEnabled}"/>
<Setter Property="Visibility" Value="{Binding Visibility}" />
<Setter Property="IsChecked" Value="{Binding IsChecked}" />
<Setter Property="IsSeparator" Value="{Binding IsSeperator}" />
<Setter Property="DropDownPlacement" Value="Left" />
</Style>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
<ResourceDictionary Source="Resources/Icons.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Menu Row -->
<Grid Background="#CC119EDA"
HorizontalAlignment="Stretch"
>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<!-- Global Commands -->
<ColumnDefinition />
<!-- Separator -->
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<WrapPanel x:Name="global"
Margin="0,2,0,0">
<Button x:Name="btnOpenFolder"
Width="35" Height="30"
BorderThickness="0"
Background="Transparent"
Click="OpenFolder_Click"
>
<Canvas Width="48" Height="48" Clip="F1 M 0,0L 48,0L 48,48L 0,48L 0,0" UseLayoutRounding="False">
<Path Width="26.5833" Height="19" Canvas.Left="0" Canvas.Top="0" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 16.6668,20L 13,28.5336L 13,16L 23,16L 23,15C 23,13.8954 23.8954,13 25,13L 32,13C 33.1046,13 35,14.8954 35,16L 35,20L 16.6668,20 Z M 35,32L 28,32L 13,32L 17.5833,21L 39.5833,21L 35,32 Z " />
</Canvas>
<telerik:RadContextMenu.ContextMenu>
<menu:OpenFolderCM ItemContainerStyle="{StaticResource MenuItemContainerStyle}" />
</telerik:RadContextMenu.ContextMenu>
</Button>
<Button Click="Refresh_Click"
Width="35" Height="30"
BorderThickness="0"
Background="Transparent"
Padding="2"
>
<Canvas Width="48" Height="48" Clip="F1 M 0,0L 48,0L 48,48L 0,48L 0,0" UseLayoutRounding="False">
<Path Width="22" Height="26" Canvas.Left="4" Canvas.Top="0" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 24,13C 27.1521,13 29.9945,14.3258 32,16.4501L 32,11L 35,14L 35,22L 27,22L 24,19L 29.5903,19C 28.217,17.4656 26.2212,16.5 24,16.5C 20.1969,16.5 17.055,19.3306 16.5661,23L 13.0448,23C 13.5501,17.3935 18.262,13 24,13 Z M 24,31.5C 27.8031,31.5 30.945,28.6694 31.4339,25L 34.9552,25C 34.4499,30.6065 29.738,35 24,35C 20.8479,35 18.0055,33.6742 16,31.5499L 16,37L 13,34L 13,26L 21,26L 24,29L 18.4097,29C 19.783,30.5344 21.7787,31.5 24,31.5 Z " />
</Canvas>
</Button>
<Button Click="ScreenSaver_Click"
Width="35" Height="30"
BorderThickness="0"
Background="Transparent"
Padding="2"
>
<Viewbox Stretch="Uniform" RenderTransformOrigin="0.5,0.5">
<Viewbox.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="2" ScaleY="2"/>
</TransformGroup>
</Viewbox.RenderTransform>
<ContentControl Content="{StaticResource appbar_image_beach}" />
</Viewbox>
<!--<Rectangle>
<Rectangle.OpacityMask>
<VisualBrush Visual="{StaticResource appbar_image_ants}" Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>-->
<!--Content="{StaticResource appbar_image_ants}"-->
</Button>
</WrapPanel>
<WrapPanel Grid.Column="3"
Background="Transparent"
Orientation="Horizontal"
FlowDirection="RightToLeft"
>
<Button Click="btnAscending_Click"
Background="Transparent"
MinWidth="100"
BorderThickness="0"
>
<TextBlock FontSize="12" FontWeight="Normal">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Text" Value="Descending" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=_this, Path=SortAscending}" Value="True">
<Setter Property="Text" Value="Ascending" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Button>
<ComboBox x:Name="cbSortKind"
SelectionChanged="CbSortKind_SelectionChanged"
Background="Transparent"
BorderThickness="0"
BorderBrush="Transparent"
MinWidth="100"
>
<ComboBoxItem Tag="Alpha">Alphabetic</ComboBoxItem>
<ComboBoxItem Tag="Date">Date Time</ComboBoxItem>
<ComboBoxItem Tag="Number" IsSelected="True">Numeric</ComboBoxItem>
<ComboBoxItem Tag="AHash">
<ComboBoxItem.Style>
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="Visibility" Value="Visible" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=_this, Path=IsDirectoriesView}" Value="True">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</ComboBoxItem.Style>
Average Hash
</ComboBoxItem>
<ComboBoxItem Tag="PHash">
<ComboBoxItem.Style>
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="Visibility" Value="Visible" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=_this, Path=IsDirectoriesView}" Value="True">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</ComboBoxItem.Style>
Perceptual Hash
</ComboBoxItem>
</ComboBox>
<ToggleButton Margin="0"
Width="20" Height="30" Padding="1"
Background="Transparent"
BorderThickness="0"
IsChecked="{Binding Source={x:Static settings:SettingsFile.Instance},
Path=SortLock, Mode=TwoWay}"
ToolTip="Lock sort criteria"
>
<ToggleButton.Content>
<Viewbox Stretch="Fill" RenderTransformOrigin="0.5,0.5">
<!--<Viewbox.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.5" ScaleY="0.5"/>
</TransformGroup>
</Viewbox.RenderTransform>-->
<ContentControl Content="{StaticResource appbar_lock}" />
</Viewbox>
</ToggleButton.Content>
</ToggleButton>
<Button x:Name="btnSafe"
Width="35" Height="30" Padding="2"
Background="Transparent"
BorderThickness="0"
Click="BtnSafe_Click">
<Canvas Width="48" Height="48" Clip="F1 M 0,0L 48,0L 48,48L 0,48L 0,0" UseLayoutRounding="False">
<Path Stretch="Fill" Fill="Transparent" Stroke="Black" StrokeThickness="5" Data="M 0,0 A 180,180 180 1 1 1,1 Z" />
</Canvas>
<Button.Style>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="ToolTip" Value="Not Safe" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=_this, Path=ShowHidden}" Value="{x:Static flib:eHidden.HideHidden}">
<Setter Property="ToolTip" Value="Office Safe" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Button x:Name="btnHide"
Width="35" Height="30" Padding="2"
Background="Transparent"
BorderThickness="0"
Click="BtnHide_Click">
<Canvas Width="48" Height="48" Clip="F1 M 0,0L 48,0L 48,48L 0,48L 0,0" UseLayoutRounding="False">
<Path Stretch="Fill" Fill="Transparent" Stroke="Black" StrokeThickness="5" Data="M 0,0 A 180,180 180 1 1 1,1 Z" />
</Canvas>
<Button.Style>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<!--
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=_this, Path=IsHistoryView}" Value="True">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
-->
<Setter Property="ToolTip" Value="Showing All" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=_this, Path=ShowHidden}" Value="{x:Static flib:eHidden.HideHidden}">
<Setter Property="ToolTip" Value="Hiding Hidden" />
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=_this, Path=ShowHidden}" Value="{x:Static flib:eHidden.ShowOnlyHidden}">
<Setter Property="ToolTip" Value="Showing Only Hidden" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</WrapPanel>
</Grid>
<!-- end Menu -->
<ListBox ItemsSource="{Binding}" x:Name="_items"
Background="Black"
HorizontalAlignment="Right"
Grid.Row="1"
>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<telerik:VirtualizingWrapPanel
ItemWidth="{Binding ElementName=_this, Path=ThumbSizePlus}"
ItemHeight="{Binding ElementName=_this, Path=ThumbSizePlus}"
ScrollStep="{Binding ElementName=_this, Path=ThumbSizePlus}" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderBrush="BlanchedAlmond" BorderThickness="1">
<Grid>
<StackPanel Margin="1"
HorizontalAlignment="Stretch"
Background="Black"
SizeChanged="Tile_SizeChanged"
Loaded="ItemPanel_Loaded"
MouseUp="Image_Clicked"
AllowDrop="True"
Drop="DropItems_ListBox"
DragEnter="DragEnter_ListBox"
>
<TextBlock Padding="5,2" HorizontalAlignment="Stretch"
Text="{Binding Name}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="Black" />
<Setter Property="Background" Value="LemonChiffon" />
<Style.Triggers>
<DataTrigger Binding="{Binding Ignored}" Value="True">
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="Gray" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Grid>
<Image RenderOptions.BitmapScalingMode="HighQuality"
Height="{Binding ElementName=_this, Path=ThumbSize.Height}"
>
<gif:ImageBehavior.AnimatedSource>
<MultiBinding Converter="{c:ImageConverter}">
<Binding Path="ThumbLocation" />
<Binding Path="FullName" />
</MultiBinding>
</gif:ImageBehavior.AnimatedSource>
</Image>
<ContentControl Content="{StaticResource appbar_control_play}" Visibility="{Binding PlayVisible}" />
</Grid>
<StackPanel.ToolTip>
<ToolTip>
<StackPanel>
<TextBlock Text="{Binding Name}" Background="LightBlue" Foreground="Black" />
<TextBlock Text="{Binding DirectoryNameDisplay}" />
<TextBlock Text="{Binding Timestamp}" />
<!--<TextBlock>
<Run Text="Index: " />
<Run Text="{Binding Index}" />
</TextBlock>-->
<TextBlock Visibility="{Binding VisitsVisible}">
<Run Text="Visits: " />
<Run Text="{Binding Visited}" />
</TextBlock>
<TextBlock Visibility="{Binding SizeVisible}" Text="{Binding SizeString}" />
</StackPanel>
</ToolTip>
</StackPanel.ToolTip>
</StackPanel>
<CheckBox VerticalAlignment="Top" HorizontalAlignment="Left" Opacity="1"
x:Name="cbChecked"
IsChecked="{Binding IsSelected, Mode=TwoWay}"
>
<CheckBox.LayoutTransform>
<ScaleTransform ScaleX="2" ScaleY="2" />
</CheckBox.LayoutTransform>
<CheckBox.Style>
<Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource {x:Type CheckBox}}">
<Setter Property="Visibility" Value="Collapsed" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=IsMouseOver}" Value="True">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked}" Value="True">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</CheckBox.Style>
</CheckBox>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
<telerik:RadContextMenu.ContextMenu>
<menu:TilesCM ItemContainerStyle="{StaticResource MenuItemContainerStyle}">
<menu:TilesCM.Style>
<Style TargetType="{x:Type menu:TilesCM}">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=_this, Path=IsEditMode}" Value="True">
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
</menu:TilesCM.Style>
</menu:TilesCM>
</telerik:RadContextMenu.ContextMenu>
</ListBox>
<!--</ScrollViewer>-->
<Grid x:Name="pStatus" Grid.Row="2"
Background="LightSkyBlue"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.Resources>
<Storyboard x:Key="pStatusExpand"
AccelerationRatio=".4"
DecelerationRatio=".4">
<DoubleAnimation Storyboard.TargetProperty="Tag"
Duration="0:0:0.4"
From="0" To="1"
/>
</Storyboard>
<Storyboard x:Key="pStatusHide"
AccelerationRatio=".4"
DecelerationRatio=".4">
<DoubleAnimation Storyboard.TargetProperty="Tag"
Duration="0:0:1"
From="1" To="0"
/>
</Storyboard>
<c:IsCountEqualMax x:Key="MaxConverter" />
</Grid.Resources>
<Grid.Tag>
<sys:Double>0.0</sys:Double>
</Grid.Tag>
<Grid.Height>
<MultiBinding Converter="{c:MathConverter}" ConverterParameter="a*b">
<Binding ElementName="_this" Path="StatusHeight" />
<Binding RelativeSource="{RelativeSource Self}" Path="Tag" />
</MultiBinding>
</Grid.Height>
<Border Grid.Column="1" Margin="0,0,5,0"
BorderThickness="1"
BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrush}}">
<StackPanel x:Name="statusCounter"
VerticalAlignment="Center"
Orientation="Horizontal"
LayoutUpdated="statusCounter_LayoutUpdated"
>
<StackPanel.Resources>
<Style TargetType="{x:Type TextBlock}">
<Style.Setters>
<Setter Property="Foreground" Value="Black" />
<Setter Property="Margin" Value="3" />
<Setter Property="FontSize" Value="12" />
</Style.Setters>
</Style>
</StackPanel.Resources>
<TextBlock Text="Loading " />
<TextBlock Text="{Binding ElementName=_this, Path=View.Images.Count}" />
<TextBlock Text=" of " />
<TextBlock Text="{Binding ElementName=_this, Path=View.MaxImages}" />
<TextBlock Text=" images" />
</StackPanel>
</Border>
<Grid.Style>
<Style TargetType="{x:Type Grid}">
<Style.Triggers>
<DataTrigger Value="true">
<DataTrigger.Binding>
<MultiBinding Converter="{StaticResource MaxConverter}">
<Binding ElementName="_this" Path="View.Images.Count" />
<Binding ElementName="_this" Path="View.MaxImages" />
</MultiBinding>
</DataTrigger.Binding>
<DataTrigger.EnterActions>
<RemoveStoryboard BeginStoryboardName="Expand" />
<BeginStoryboard Name="Hide" Storyboard="{StaticResource pStatusHide}" />
</DataTrigger.EnterActions>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=_this, Path=View.Images.Count}" Value="0">
<DataTrigger.EnterActions>
<RemoveStoryboard BeginStoryboardName="Hide" />
<BeginStoryboard Name="Expand" Storyboard="{StaticResource pStatusExpand}" />
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
</Grid>
</Grid>
</UserControl>
-- app.xaml ---
<Application x:Class="SeaRisen.SFFv2.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml"
Startup="OnStartup"
Exit="Application_Exit"
>
<Application.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
<Viewbox x:Key="PlayIcon" x:Shared="False">
<TextBlock FontFamily="Segoe MDL2 Assets"
Text="&#xE768;" />
</Viewbox>
<Viewbox x:Key="appbar_control_play"
x:Shared="False">
<Path Width="20.5832"
Height="31.6667"
Fill="{DynamicResource BlackBrush}"
Data="F1 M 30.0833,22.1667L 50.6665,37.6043L 50.6665,38.7918L 30.0833,53.8333L 30.0833,22.1667 Z " />
</Viewbox>
</Application.Resources>
</Application>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment