mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-11 17:59:17 +00:00
add volume slider
This commit is contained in:
@@ -77,7 +77,7 @@
|
||||
<!-- Custom Slider Control -->
|
||||
<ControlTemplate x:Key="CustomSliderThumbTemplate" TargetType="{x:Type Thumb}">
|
||||
<Grid HorizontalAlignment="Center" UseLayoutRounding="True" VerticalAlignment="Center">
|
||||
<Rectangle x:Name="grip" Fill="{DynamicResource WindowTextForeground}" Width="8"
|
||||
<Rectangle x:Name="grip" Fill="{DynamicResource WindowTextForeground}" Width="5"
|
||||
Height="{Binding Path=Height, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
StrokeThickness="0"
|
||||
UseLayoutRounding="True" Stretch="Fill" RadiusX="3" RadiusY="3" />
|
||||
@@ -101,18 +101,18 @@
|
||||
<RowDefinition Height="{TemplateBinding MinHeight}" />
|
||||
</Grid.RowDefinitions>
|
||||
<DockPanel LastChildFill="True">
|
||||
<Border ClipToBounds="True" x:Name="PART_SelectionRange" Height="3" Visibility="Visible">
|
||||
<Rectangle RadiusX="1" RadiusY="1" Margin="4,0,-4,0"
|
||||
<Border ClipToBounds="True" x:Name="PART_SelectionRange" Height="1" Visibility="Visible">
|
||||
<Rectangle RadiusX="1" RadiusY="1" Margin="4,0,-2,0"
|
||||
Fill="{DynamicResource WindowTextForeground}" />
|
||||
</Border>
|
||||
<Border ClipToBounds="True" Height="3" Visibility="Visible">
|
||||
<Rectangle x:Name="PART_NegativeSelection" RadiusX="1" RadiusY="1" Margin="8,0,4,0"
|
||||
Fill="{DynamicResource MainWindowBackground}" />
|
||||
<Border ClipToBounds="True" Height="1" Visibility="Visible">
|
||||
<Rectangle x:Name="PART_NegativeSelection" RadiusX="1" RadiusY="1" Margin="-2,0,4,0"
|
||||
Fill="{DynamicResource WindowTextForegroundAlternative}" />
|
||||
</Border>
|
||||
</DockPanel>
|
||||
<Track x:Name="PART_Track">
|
||||
<Track.Thumb>
|
||||
<Thumb x:Name="Thumb" Focusable="False" Width="8" Height="{TemplateBinding MinHeight}"
|
||||
<Thumb x:Name="Thumb" Focusable="False" Width="5" Height="{TemplateBinding MinHeight}"
|
||||
OverridesDefaultStyle="True" Template="{StaticResource CustomSliderThumbTemplate}"
|
||||
VerticalAlignment="Center" />
|
||||
</Track.Thumb>
|
||||
@@ -124,9 +124,9 @@
|
||||
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="MinHeight" Value="16" />
|
||||
<Setter Property="MaxHeight" Value="16" />
|
||||
<Setter Property="Height" Value="16" />
|
||||
<Setter Property="MinHeight" Value="14" />
|
||||
<Setter Property="MaxHeight" Value="14" />
|
||||
<Setter Property="Height" Value="14" />
|
||||
<Setter Property="Minimum" Value="0" />
|
||||
<Setter Property="IsSnapToTickEnabled" Value="True" />
|
||||
<Setter Property="SmallChange" Value="0.01" />
|
||||
|
@@ -156,7 +156,8 @@
|
||||
</Style>
|
||||
</Button.Style>
|
||||
</Button>
|
||||
<Button x:Name="buttonTime" Width="37" Style="{StaticResource ControlButtonStyle}" DockPanel.Dock="Right" Tag="Time">
|
||||
<Button x:Name="buttonTime" Width="37" Style="{StaticResource ControlButtonStyle}"
|
||||
DockPanel.Dock="Right" Tag="Time">
|
||||
<TextBlock VerticalAlignment="Center" FontSize="11"
|
||||
FontFamily="{Binding ElementName=viewerPanel, Path=FontFamily}"
|
||||
Foreground="{DynamicResource CaptionButtonIconForeground}">
|
||||
@@ -174,39 +175,19 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</TextBlock>
|
||||
</Button>
|
||||
<Slider x:Name="sliderProgress" Style="{StaticResource PositionSliderStyle}"
|
||||
SmallChange="0.00001" LargeChange="0.01" Maximum="1"
|
||||
Value="{Binding Position, ElementName=mediaElement}" />
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
<!--<Grid Height="32" Width="100" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
||||
Background="{DynamicResource CaptionBackground}" Margin="0,0,0,32">
|
||||
<Grid.Style>
|
||||
<Style TargetType="Grid">
|
||||
<Setter Property="Opacity" Value="0" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=buttonMute, Path=IsMouseOver}" Value="True">
|
||||
<DataTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard TargetProperty="Opacity">
|
||||
<DoubleAnimation To="1" Duration="0:0:0.1" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</DataTrigger.EnterActions>
|
||||
<DataTrigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard TargetProperty="Opacity">
|
||||
<DoubleAnimation To="0" Duration="0:0:0.1" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</DataTrigger.ExitActions>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Style>
|
||||
<Slider Style="{StaticResource CustomSliderStyle}" Width="100" Maximum="100" Value="{Binding ElementName=mediaElement, Path=Volume}" />
|
||||
</Grid>-->
|
||||
<Grid x:Name="volumeSliderLayer" Background="Transparent" Visibility="Collapsed">
|
||||
<Grid Height="32" Width="130" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
||||
Background="{DynamicResource CaptionButtonHoverBackground}" Margin="0,0,0,32">
|
||||
<Slider Style="{StaticResource CustomSliderStyle}" Width="110" Maximum="100"
|
||||
Value="{Binding ElementName=mediaElement, Path=Volume}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
@@ -65,7 +65,8 @@ namespace QuickLook.Plugin.VideoViewer
|
||||
|
||||
buttonPlayPause.Click += TogglePlayPause;
|
||||
buttonTime.Click += (sender, e) => buttonTime.Tag = (string) buttonTime.Tag == "Time" ? "Length" : "Time";
|
||||
buttonMute.Click += (sender, e) => IsMuted = !IsMuted;
|
||||
buttonMute.Click += (sender, e) => volumeSliderLayer.Visibility = Visibility.Visible;
|
||||
volumeSliderLayer.MouseDown += (sender, e) => volumeSliderLayer.Visibility = Visibility.Collapsed;
|
||||
|
||||
sliderProgress.PreviewMouseDown += (sender, e) =>
|
||||
{
|
||||
|
Reference in New Issue
Block a user