如何隐藏MediaPlayerElement的ProgressBar?

时间:2019-09-07 03:19:45

标签: uwp media-player uwp-xaml

缓冲在线媒体时,MediaPlayerElement始终显示ProgressBar。我想隐藏它并使用我自己的。 怎么样?谢谢。

enter image description here

1 个答案:

答案 0 :(得分:1)

我修改了MediaTransportControls的样式,并设置了 缓冲时将“ BufferingProgressBar.Visibility”更改为“ Collapse”。

<VisualStateGroup x:Name="MediaStates">
    <VisualState x:Name="Normal" />
    <VisualState x:Name="Buffering">
        <VisualState.Setters>
            <Setter Target="BufferingProgressBar.Visibility" Value="Collapse" />
        </VisualState.Setters>
    </VisualState>
    <VisualState x:Name="Loading">
        <VisualState.Setters>
            <Setter Target="BufferingProgressBar.Visibility" Value="Collapse" />
        </VisualState.Setters>

        <Storyboard>
            <DoubleAnimation Storyboard.TargetName="ProgressSlider"
                Storyboard.TargetProperty="Opacity"
                To="0"
                Duration="0" />
            <DoubleAnimation Storyboard.TargetName="MediaControlsCommandBar"
                Storyboard.TargetProperty="Opacity"
                To="0"
                Duration="0" />
        </Storyboard>
    </VisualState>

</VisualStateGroup>