c# - Adding sound effects to WPF Surface application -
i trying play sound whenever object touched/moved in wpf surface application, depict has been selected or movement. here tried doesn't seem work.
soundplayeraction soundplayeraction = new soundplayeraction(); soundplayeraction.source = new uri(@"c:\resources\selection.wav", urikind.relativeorabsolute); eventtrigger eventtrigger = new eventtrigger(touchenterevent); // event want trigger sound effect. eventtrigger.actions.add(soundplayeraction);
any feedback or ideas appreciated.
create new folder in project , rename sounds insert sound files in , try this:
soundplayeraction soundplayeraction = new soundplayeraction(); soundplayeraction.source = new uri(@"sounds\selection.wav", urikind.relativeorabsolute); eventtrigger eventtrigger = new eventtrigger(touchenterevent); // event want trigger sound effect. eventtrigger.actions.add(soundplayeraction); triggers.add(eventtrigger); // add event trigger window.triggers collection.
Comments
Post a Comment