title: InvalidOperationException : This freezable cannot be frozen
body: <p>I am working on implementing global shortcut keys (i.e. application wide shortcut keys) for my WPF application, which has multiple windows. To achieve that, I am doing:</p>
  <pre><code>CommandManager.RegisterClassInputBinding(typeof(Window), o); // o is just a keybinding
  </code></pre>
  <p>That is, I am trying to register a keybinding with the Window class so that my shortcut key works, no matter what window is active. But my code throws the following exception on reaching this line:</p>
  <blockquote>
  <p>System.InvalidOperationException was unhandled by user code</p>
  <p>Message=This Freezable cannot be frozen.</p>
  <p>Source=WindowsBase</p>
  </blockquote>
  <p>StackTrace:</p>
  <pre><code>at System.Windows.Freezable.Freeze()
  at System.Windows.Input.CommandManager.RegisterClassInputBinding(Type type, InputBinding inputBinding)
  </code></pre>
  <p>This is how the keybinding <code>o</code> is created:</p>
  <pre><code>KeyBinding o = new KeyBinding() 
  { 
    Command = f, 
    CommandParameter = popup, 
    Key = Key.Q, 
    Modifiers = ModifierKeys.Control 
  }; 
  </code></pre>
  <p><code>popup</code> is just a wpf popup. <code>f</code> is an object of a class that implements <code>ICommand</code> interface.</p>
  <p>I have looked up similar questions on StackOverflow and they seem to be caused by the freezable object SolidColorBursh. I don't think that that applies to my case. Does anyone know what is going on?</p>