語言

ElementSoundPlayer 類別

定義

代表 XAML 控制音色的播放器。

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.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
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.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ElementSoundPlayer
Public NotInheritable Class ElementSoundPlayer
繼承
Object Platform::Object IInspectable ElementSoundPlayer
屬性

範例

Tip

更多資訊、設計指導與程式碼範例,請參見 聲音。

WinUI 3 Gallery 應用程式包含大部分 WinUI 3 控制項、特性和功能的互動式範例。 從 Microsoft Store 取得應用程式,或在 GitHub 上取得原始程式碼。

備註

更多資訊請參閱 音效設計指引。

屬性

名稱 Description
SpatialAudioMode

會取得或設定一個值,指示空間音訊是開啟、關閉或自動處理。

State

取得或設定一個值,指定系統是否播放控制音效。

Volume

用來取得或設定播放方法播放的聲音音量。

方法

名稱 Description
Play(ElementSoundKind)

播放指定的音色。

適用於