MediaOpened Event
Collapse the table of content
Expand the table of content

MediaElement.MediaOpened Event

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Occurs when the media stream has been validated and opened, and the file headers have been read.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

public event RoutedEventHandler MediaOpened
<MediaElement MediaOpened="eventhandler" .../>

A MediaElement object generally has two types of properties:

  • Properties that are settable and that declare the appearance or behavior of the MediaElement.

  • Read-only properties that report on the characteristics of the current Source file that is loaded by the MediaElement.

Properties in this second category will not contain valid values until the MediaElement raises the MediaOpened event. The following is a list of MediaElement properties that will not be valid until after MediaOpened is raised by that element.

In addition, the Position property will be null before the MediaOpened event. However, Position is different from the other properties in the second group because it is settable. You should not attempt to set Position until MediaOpened is raised. You also should not set an initial Position value in XAML.

If the AutoPlay property is set to false, the media will be paused when the MediaOpened event occurs.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2016 Microsoft