mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-07 23:43:19 +02:00
* Reset branch for WPF changes * Convert BMP to PNG; fix link-out-of-scope err * Add snippets for WPF... 6794 files!!!! * Add missing snippets * update file updated between migration * Fix paths to include * update breadcrumb and toc * fix index links * fix index links * fix index links * fix markdown
27 lines
1.2 KiB
Markdown
27 lines
1.2 KiB
Markdown
---
|
|
title: "How to: Trigger Media Playback with a User Event"
|
|
ms.date: "03/30/2017"
|
|
helpviewer_keywords:
|
|
- "synchronizing media playback with events [WPF]"
|
|
- "playback of media [WPF], synchronizing with events"
|
|
- "media [WPF], synchronizing playback with events"
|
|
- "multimedia [WPF], synchronizing media playback with events"
|
|
ms.assetid: c4dbe632-6e7f-4d7f-9df5-98737a758bc3
|
|
---
|
|
# How to: Trigger Media Playback with a User Event
|
|
This example shows how to synchronize media playback with an event.
|
|
|
|
## Example
|
|
The following example uses the <xref:System.Windows.Controls.MediaElement> control and the <xref:System.Windows.Media.MediaTimeline> class to play a sound that occurs when the user clicks a <xref:System.Windows.Controls.Button>.
|
|
|
|
[!code-xaml[MediaGallery_snippet#SoundFromUserEventExampleWholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/MediaGallery_snippet/CSharp/SoundFromUserEventExample.xaml#soundfromusereventexamplewholepage)]
|
|
|
|
## See also
|
|
|
|
- <xref:System.Windows.Controls.MediaElement>
|
|
- <xref:System.Windows.Media.MediaTimeline>
|
|
- <xref:System.Windows.EventTrigger.RoutedEvent%2A>
|
|
- <xref:System.Windows.Media.Animation.Storyboard>
|
|
- [How-to Topics](audio-and-video-how-to-topics.md)
|
|
- [Graphics and Multimedia](index.md)
|