samc
Topic Author
Posts: 94
Joined: 21 Aug 2019, 19:22

audio when user controls appear / disappear

18 Sep 2025, 03:04

We've been using the audio hooks on buttons, but we'd like to integrate audio better into our app and aren't sure how to do it.

We'd like trigger audio when a user control / screen appears and when a user control / screen disappears. Is there a best practice / best way to do this?

I saw this thread: viewtopic.php?p=16824 and tried to see if I could do something similar for visibility changing to collapse or to visibile..

Is there an EventTrigger I can wire up to handle this? I noticed on https://www.noesisengine.com/docs/Gui.C ... tml#events that there is an IsVisibleChanged event, but I'm not sure how to test against the new visibility value here for this event.

Suggestions on how to accomplish this? Maybe there is a completely separate way that would be best to do this?

thanks,
sam
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: audio when user controls appear / disappear

18 Sep 2025, 17:49

If you need to do different actions when IsVisible is true vs when it is false you should use a DataTrigger instead of an EventTrigger:
<Grid x:Name="LayoutRoot">
  <b:Interaction.Triggers>
    <b:DataTrigger Binding="{Binding IsVisible, ElementName=LayoutRoot}" Value="True">
      <audio:AudioAction .../>
    </b:DataTrigger>
    <b:DataTrigger Binding="{Binding IsVisible, ElementName=LayoutRoot}" Value="False">
      <audio:AudioAction .../>
    </b:DataTrigger>
  </b:Interaction.Triggers>
  ...
</Grid>
Is this what you're looking for?
 
samc
Topic Author
Posts: 94
Joined: 21 Aug 2019, 19:22

Re: audio when user controls appear / disappear

18 Sep 2025, 18:05

This looks great! let me give this a shot!

thanks,
sam

Who is online

Users browsing this forum: No registered users and 9 guests