Share via


ElementSoundPlayer Class

Definition

Represents a player for XAML control sounds.

public ref class ElementSoundPlayer sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 196608)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ElementSoundPlayer final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 196608)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ElementSoundPlayer
Public NotInheritable Class ElementSoundPlayer
Inheritance
Object Platform::Object IInspectable ElementSoundPlayer
Attributes

Windows requirements

Device family
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v3.0)

Examples

Tip

For more info, design guidance, and code examples, see Sound.

If you have the WinUI 2 Gallery app installed, click here to open the app and see the ElementSoundPlayer in action.

Remarks

For more info, see Sound in UWP apps.

Version history

Windows version SDK version Value added
1803 17134 SpatialAudioMode

Properties

SpatialAudioMode

Gets or sets a value that indicates whether spatial audio is on, off, or handled automatically.

State

Gets or sets a value that specifies whether the system plays control sounds.

Volume

Gets or sets the volume of the sounds played by the Play method.

Methods

Play(ElementSoundKind)

Plays the specified sound.

Applies to