Udostępnij za pośrednictwem


SystemMediaTransportControls.ButtonPressed Event

Definition

Occurs when a button is pressed on the SystemMediaTransportControls.

// Register
event_token ButtonPressed(TypedEventHandler<SystemMediaTransportControls, SystemMediaTransportControlsButtonPressedEventArgs const&> const& handler) const;

// Revoke with event_token
void ButtonPressed(event_token const* cookie) const;

// Revoke with event_revoker
SystemMediaTransportControls::ButtonPressed_revoker ButtonPressed(auto_revoke_t, TypedEventHandler<SystemMediaTransportControls, SystemMediaTransportControlsButtonPressedEventArgs const&> const& handler) const;
public event TypedEventHandler<SystemMediaTransportControls,SystemMediaTransportControlsButtonPressedEventArgs> ButtonPressed;
function onButtonPressed(eventArgs) { /* Your code */ }
systemMediaTransportControls.addEventListener("buttonpressed", onButtonPressed);
systemMediaTransportControls.removeEventListener("buttonpressed", onButtonPressed);
- or -
systemMediaTransportControls.onbuttonpressed = onButtonPressed;
Public Custom Event ButtonPressed As TypedEventHandler(Of SystemMediaTransportControls, SystemMediaTransportControlsButtonPressedEventArgs) 

Event Type

Remarks

Starting with Windows 10, version 1607, UWP apps that use the MediaPlayer class or AudioGraph class to play media are automatically integrated with the SMTC by default. For some scenarios, you may want to manually control the SMTC. In this case, you should ButtonPressed event to be notified that the user has pressed one of the SMTC buttons. For how-to guidance on manually controlling the SMTC, see Manual control of the System Media Transport Controls.

Applies to

See also