title: Listen to global variable change in XAML
body: <p>I have a global variable indicating if my app is in read-only mode</p>
  
  <pre><code>public static class Global
  {
      public static event PropertyChangedEventHandler StaticPropertyChanged;
      private static void OnStaticPropertyChanged(string propertyName)
      {
          StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(propertyName));
      }
  
      private static bool _isReadOnly = false;
      public static bool IsReadOnly
      {
          get { return _isReadOnly; }
          set
          {
              _isReadOnly = value;
              OnStaticPropertyChanged("IsReadOnly");
          }
      }
  }
  </code></pre>
  
  <p>Now I would like to listen to that in all my GUIs to turn off editing. For instance I have a DataGrid</p>
  
  <pre><code>&lt;UserControl xmlns:models="clr-namespace:MyApp.Models" &gt;
     &lt;DataGrid IsReadOnly="{Binding Path=(models:Global.IsReadOnly)}"  /&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>How can I listen to the global variable instead of a local one in my ViewModel? Currently I get the error message</p>
  
  <blockquote>
    <p>The name Global does not exist in the namespace Models. </p>
  </blockquote>
  
  <p>But it does! And I already tried to recompile and restart VS.</p>