2 out of 3 rated this helpful - Rate this topic

MediaElement.Volume Property

Gets or sets the media's volume.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
public double Volume { get; set; }
<MediaElement Volume="double"/>

Property Value

Type: System.Double
The media's volume represented on a linear scale between 0 and 1. The default is 0.5.

Dependency property identifier field: VolumeProperty

Volume can be difficult to quantify because each media file has a different baseline for its recorded or perceived audio level. Also, true audio volume as represented on the decibel scale is inherently logarithmic. You can think of the Volume property as representing the position value of an audio mixer slider control, with 0 being all the way down and 1 being all the way up.

Platform Notes

Silverlight for Windows Phone Silverlight for Windows Phone

 The default volume on Silverlight for Windows Phone is 0.85.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
NB: The Volume and IsMuted properties don't work unless the MediaElement is added to the Visual Tree
See the discussion here: http://forums.silverlight.net/forums/p/184264/419579.aspx

In effect, if you simply new-up a MediaElement, and play stuff through it, everything will play fine, but the Volume and IsMuted properties won't work when you try to set them through code. You have to do something like this to get them to work:

	LayoutRoot.Children.Add(mediaElement);
	mediaElement.Visibility = Visibility.Collapsed;