HelloWindowsPhone
HelloWindowsPhone

Reputation: 700

Manipulation events of MediaElement not fire when on FullWindows mode

When I set player not in fullscreen (player.IsFullWindows = false), event work normally but when change player to full screen all manipulation event not work. Anyone have solution?

                <MediaElement Name="player"
                              Margin="10,5" ManipulationCompleted="player_ManipulationCompleted"
                              ManipulationDelta="Grid_ManipulationDelta"
                              ManipulationMode="TranslateX"
                              >

Upvotes: 0

Views: 227

Answers (1)

Amy Peng - MSFT
Amy Peng - MSFT

Reputation: 1902

I can reproduce this scenario by enabling both the IsFullWindow="True" and the AreTransportControlsEnabled="True". I think it makes sense, because when we are in the Full Window mode, it will go to the new layer named FullWindowMediaRoot instead of the MediaElement. Inside the FullWindowMediaRoot, it is the MediaTransportControls. You can see that clearly by using the Live Visual Tree as following: enter image description here

So when we are in the Full Window mode, we need to handle the manipulation event of the TransportControls instead of the manipulation event of the MediaElement as following:

public MainPage()
    {
        this.InitializeComponent();
        player.TransportControls.ManipulationMode = ManipulationModes.TranslateX;
        player.TransportControls.ManipulationDelta += TransportControls_ManipulationDelta;
        player.TransportControls.ManipulationCompleted += TransportControls_ManipulationCompleted;

    }

    private void TransportControls_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
    {

    }

    private void TransportControls_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
    {

    }

Thanks.

Upvotes: 2

Related Questions