KeyboardFriendly
KeyboardFriendly

Reputation: 1798

Applying Trigger in Xaml

I am trying to play a wav sound on a button click:

I am trying to use the soundplayeractionclass.

http://msdn.microsoft.com/en-us/library/system.windows.controls.soundplayeraction.aspx

Here is a xaml snippet

<UserControl.Resources>

    <UserControl.Triggers>
        <EventTrigger RoutedEvent="Button.Click" SourceName="btnSave">
            <EventTrigger.Actions>
                <SoundPlayerAction Source="Media\notify.wav"/>
            </EventTrigger.Actions>
        </EventTrigger>
    </UserControl.Triggers>

It is not liking me using UserControl.Triggers any recommended approaches for this behavior?

Thanks.

Upvotes: 1

Views: 92

Answers (1)

KeyboardFriendly
KeyboardFriendly

Reputation: 1798

I used Button.Trigger and it worked this time.

Thanks!

Upvotes: 1

Related Questions