共用方式為


PlaySoundAction Class

Represents an action that will play a sound to completion.

Inheritance Hierarchy

System.Object
  DependencyObject
    Microsoft.Xaml.Interactions.Media.PlaySoundAction

Namespace:  Microsoft.Xaml.Interactions.Media
Assembly:  Microsoft.Xaml.Interactions (in Microsoft.Xaml.Interactions.dll)

Syntax

'Declaration
Public NotInheritable Class PlaySoundAction _
    Inherits DependencyObject _
    Implements IAction
public sealed class PlaySoundAction : DependencyObject, 
    IAction
public ref class PlaySoundAction sealed : public DependencyObject, 
    IAction
[<Sealed>]
type PlaySoundAction =  
    class 
        inherit DependencyObject 
        interface IAction 
    end
public final class PlaySoundAction extends DependencyObject implements IAction

The PlaySoundAction type exposes the following members.

Constructors

  Name Description
Public method PlaySoundAction Initializes a new instance of the PlaySoundAction class.

Top

Properties

  Name Description
Public property Dispatcher (Inherited from DependencyObject.)
Public property Source Gets or sets the location of the sound file. This is used to set the source property of a MediaElement. This is a dependency property.
Public property Volume Gets or set the volume of the sound. This is used to set the Volume property of the MediaElement. This is a dependency property.

Top

Methods

  Name Description
Public method ClearValue (Inherited from DependencyObject.)
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public method Execute Executes the action.
Public method GetAnimationBaseValue (Inherited from DependencyObject.)
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method GetValue (Inherited from DependencyObject.)
Public method ReadLocalValue (Inherited from DependencyObject.)
Public method SetValue (Inherited from DependencyObject.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Fields

  Name Description
Public fieldStatic member SourceProperty Specifies the location of the sound file.
Public fieldStatic member VolumeProperty Specifies the volume of the sound.

Top

Remarks

This action is intended for use with short sound effects that don't need to be stopped or controlled. If you are trying to create a music player or game, it may not meet your needs.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.Xaml.Interactions.Media Namespace