title: Global Variables Between WPF Windows
body: <p>I'm developing my first WPF application and I am confused as to how to share some information between multiple WPF Windows. Whenever you say global variable, everyone seems to shreak but in WPF I'm not sure how I'd get around my problem without using them.</p>
  
  <p>The application works as follows;</p>
  
  <blockquote>
    <p>Window 1 (MainWindow)</p>
    
    <p>This is the main user interface, it shall display a list of files and allow interactions to take place using these files.</p>
  </blockquote>
  
  <hr>
  
  <blockquote>
    <p>Window 2 (File Management)</p>
    
    <p>This window shall allow users to add new files to the application, as well as remove and rename existing files from the list.</p>
  </blockquote>
  
  <p>(This is a high level overview, I've simplified what the application does just to make it easier to explain).</p>
  
  <p>How would I pass that list of files between the two windows without storing it globally? My current thinking is to have a globally accessible class which defines both the file properties and also stores a list of the files. I would then be able to access it along the lines of:</p>
  
  <pre><code>App.Core.File.File
  App.Core.File.FileList
  </code></pre>
  
  <p>Is this considered bad practice? Is there a better way to do it for this or any other data for that matter?</p>
  
  <p>Thank you in advance.</p>
  
  <p>(Note: Persistance is not needed at the moment, so I'm not storing the file list in an XML file or a DB of some sort)</p>