如何控制自定义的 MediaTransportControls?

How to control customized MediaTransportControls?

我正在使用 MediaPlayerElement,并在播放器的右上角添加了一个 Image,然后是我的另一个:.

<Image
     x:Name="Image_CPLOGO" Width="160" Height="80" Margin="36"
     HorizontalAlignment="Right" VerticalAlignment="Top"
     Source="{TemplateBinding CPLogo}"/>

而且我在 Customize the transport controls

之后定制了自己的 MediaTransportControls
<MediaPlayerElement.TransportControls>
    <controls:CustomMediaTransportControls
        Style="{StaticResource ViuMediaTransportControls}"
        x:Name="MediaTransportControls_Custom">
    </controls:CustomMediaTransportControls>
</MediaPlayerElement.TransportControls>

然后在CustomMediaTransportControls.cs,我写了

public static readonly DependencyProperty CPLogoProperty = DependencyProperty.Register("CPLogo", typeof(ImageSource),
            typeof(CustomMediaTransportControls), new PropertyMetadata(null));
        public ImageSource CPLogo
        {
            get { return (ImageSource)GetValue(CPLogoProperty); }
            set { SetValue(CPLogoProperty, value); }
        }

最后,我写代码设置图片:

MediaTransportControls_Custom.CPLogo = new BitmapImage(new Uri("https://www.gravatar.com/avatar/ccd4648ac12e04ad93a5c3a32911383a?s=64&d=identicon&r=PG")); 

但这不起作用,为什么?

您是否将 CustonMediaTransportControl 应用于 MediaTransportControls 风格?

<Style TargetType="local:CustomMediaTransportControls">
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="FlowDirection" Value="LeftToRight" />
    <Setter Property="UseSystemFocusVisuals" Value="True" />
    <Setter Property="IsTextScaleFactorEnabled" Value="False" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="local:CustomMediaTransportControls">