programming-examples/c-sharp/Others/Play audio through event trigger.cs
2019-11-15 12:59:38 +01:00

25 lines
814 B
C#

Play audio through event trigger
<Window x:Class="SoundAndVideo.SoundPlayerTest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="SoundPlayerTest" Height="360" Width="660">
<StackPanel>
<Button>
<Button.Content>Play Through Wrapper</Button.Content>
<Button.Style>
<Style>
<Style.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<SoundPlayerAction Source="test.wav"></SoundPlayerAction>
</EventTrigger.Actions>
</EventTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</StackPanel>
</Window>