Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 912705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:25:45+00:00 2026-05-15T17:25:45+00:00

I have a plugin system in my app and I would like to prevent

  • 0

I have a plugin system in my app and I would like to prevent those plugins from playing sounds. It doesn’t have to be a perfect solution that cannot be overriden by a plugin.

EDIT: Sounds will be played via MediaElement in plugins

Thanks for an answer!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T17:25:46+00:00Added an answer on May 15, 2026 at 5:25 pm

    Disabling sounds in all MediaElements in a Window is easy. Just create an attached inherited property that enforces IsMuted=false on any MediaElement it is applied to. The property would be used like this:

    <Window my:Silencer.Silence="true" ...>
      ...
    </Window>
    

    Here is how it would be implemented:

    public class Silencer : DependencyObject
    {
      // Silence
      public static bool GetSilence(DependencyObject obj) { return (bool)obj.GetValue(SilenceProperty); }
      public static void SetSilence(DependencyObject obj, bool value) { obj.SetValue(SilenceProperty, value); }
      public static readonly DependencyProperty SilenceProperty = DependencyProperty.RegisterAttached("Silence", typeof(bool), typeof(Silencer), new FrameworkPropertyMetadata
      {
        Inherits = true,
        PropertyChangedCallback = (obj, e) =>
          {
            var element = obj as MediaElement; if(element==null) return;
            if((bool)e.NewValue)
            {
              element.SetBinding(UnmuteDetectedProperty, new Binding("IsMuted") { RelativeSource = RelativeSource.Self });
              element.IsMuted = true;
            }
            else
            {
              element.ClearValue(UnmuteDetectedProperty);
              element.IsMuted = false;
            }
          }
      });
    
      // UnmuteDetected
      public static readonly DependencyProperty UnmuteDetectedProperty = DependencyProperty.RegisterAttached("UnmuteDetected", typeof(bool), typeof(Silencer), new PropertyMetadata
      {
        PropertyChangedCallback = (obj, e) =>
          {
            ((MediaElement)obj).IsMuted = GetSilence(obj);
          }
      });
    }
    

    How it works: When Silencer is set to true on the Window, all descendants get a property change notification. This includes any MediaElement that is already in the Window or is later added to the Window. The property change notification causes the MediaElement’s UnmuteDetected property to be bound to IsMuted, then IsMuted is set to true. If the plugin’s code sets IsMuted=false, it will trigger the second PropertyChangedCallback which will set it back true again.

    Note that this only works for MediaElements, and only if they are added to the visual tree.

    Blocking more than just MediaElement sounds

    A more comprehensive method of blocking all sound from your application is Vista’s core audio APIs (also available in Windows 7), specifically the ISimpleAudioVolume interface. This can be used to block almost all ways an application can produce audio, with the exception of PlaySound() and other techniques that route their output to the system-notification audio session. Blocking sound directed to the system-notification session requires intercepting Windows calls using native code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a plugin system. Some plugins need user input. I would like
I have a problem: imagine I have a plugin-based system. I need some kind
I have a makefile template to compile a single DLL (for a plugin system).
I have a plugin for an RCP app that uses BIRT. I have a
I'd like to have my Eclipse plugin cause a URL to be opened by
I have an application in PHP (private CMS) that I would like to rewrite
I have findbugs plugin for eclipse which when run on my project will show
I have a plugin project I've been developing for a few years where the
Anyone know of a way to guarantee plugin startup order? I have a plugin
I have an ActiveX plugin that we need (if possible) to run in Firefox.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.