Search code examples
media-playeruwp-xaml

How to remove the rightmost button from MediaPlayer bar


I have a video player in my UWP app, and I want to get rid of some buttons on the seek bar bar. This is the layout:

    <MediaPlayerElement x:Name="VideoElement"
                        AreTransportControlsEnabled="True"
                        AutoPlay="True">
        <MediaPlayerElement.TransportControls>
            <MediaTransportControls IsZoomButtonVisible="False" IsFullWindowButtonVisible="False" />
        </MediaPlayerElement.TransportControls>
    </MediaPlayerElement>

enter image description here

I successfully removed "fullscreen" and "zoom" buttons, but I do not know how to remove this "playback on device" button. Does anyone know what field in MediaTransportControls controls it?


Solution

  • How to remove the rightmost button from MediaPlayer bar

    The rightmost button is CastButton you could find it in MediaTransportControls style. You could set the property Opacity="0" IsEnabled="False" to hide it.

    <AppBarButton x:Name='CastButton' Opacity="0" IsEnabled="False"
        Style='{StaticResource AppBarButtonStyle}'
        MediaTransportControlsHelper.DropoutOrder='11'>
        <AppBarButton.Icon>
            <FontIcon Glyph="&#xEC15;" />
        </AppBarButton.Icon>
    </AppBarButton>