ElementSoundPlayer Class

Definition

Represents a player for XAML control sounds.

public ref class ElementSoundPlayer sealed
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Static(Microsoft.UI.Xaml.IElementSoundPlayerStatics, 65536, "Microsoft.UI.Xaml.WinUIContract")]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.WebHostHidden]
class ElementSoundPlayer final
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Static(typeof(Microsoft.UI.Xaml.IElementSoundPlayerStatics), 65536, "Microsoft.UI.Xaml.WinUIContract")]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.WebHostHidden]
public sealed class ElementSoundPlayer
Public NotInheritable Class ElementSoundPlayer
Inheritance
ElementSoundPlayer
Attributes
Windows.Foundation.Metadata.ContractVersionAttribute Windows.Foundation.Metadata.MarshalingBehaviorAttribute Windows.Foundation.Metadata.StaticAttribute Windows.Foundation.Metadata.ThreadingAttribute Windows.Foundation.Metadata.WebHostHiddenAttribute

Examples

Tip

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

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

Remarks

For more info, see Sound in UWP apps.

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