WPF的自定义播放进度条样式

本文介绍如何在WPF中创建自定义的播放进度条样式,通过结合资源图标,实现独特的视觉效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

        <!-- 资源:颜色 -->
        <SolidColorBrush x:Key="commonSlider_BrightColor" Color="#2ED6CC"/>
        <SolidColorBrush x:Key="playSlider_DarkColor" Color="#989A9A"/>
        <SolidColorBrush x:Key="volumeSlider_DarkColor" Color="#EEEEEE"/>
        <SolidColorBrush x:Key="volumeSlider_TextColor" Color="#999999"/>
        <!-- 进度条滑块 -->
        <Style x:Key="commonSlider_RepeatButton" TargetType="RepeatButton">
            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
            <Setter Property="Focusable" Value="false" />
            <Setter Property="BorderBrush" Value="Transparent"/>
        </Style>
        <!-- 播放进度条圆钮 -->
        <Style x:Key="playSlider_Thumb" TargetType="Thumb">
            <Setter Property="BorderBrush" Value="{x:Null}" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="Focusable" Value="false" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Thumb">
                        <Grid Height="20" Width="20">
                            <Path Margin="-1,0,0,0" Data="M0,10 L11,10" Stroke="{StaticResource commonSlider_BrightColor}" StrokeThickness="4"/>
                            <Path Margin="0,0,-1,0" Data="M9,10 L21,10" Stroke="{StaticResource playSlider_DarkColor}" StrokeThickness="4"/>
                            <!--<Viewbox Height="20" Stretch="Uniform">
                                <Ellipse Width="12" Height="12" Fill="{StaticResource Slider_BrightColor}" >
                                    <Ellipse.Effect>
                                        <BlurEffect Radius="4" KernelType="Gaussian" RenderingBias="Quality"/>
                                    </Ellipse.Effect>
                                </Ellipse>
                            </Viewbox>-->
                            <Image Width="20" Height="20" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Fill"
                                   Source="/Resource/Image/Prepare/AnimationVideoPlayer/bh_pla_icon_point.png">
                            </Image>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <!-- 音量进度条圆钮 -->
        <Style x:Key="volumeSlider_Thumb" TargetType="Thumb">
            <Setter Prope
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值