title: How to fire command when page is shown
body: <p>This is my scenario.</p>
  
  <p>I have a <code>MainWindow</code> with a <code>frame</code>. This frame allows me to navigate from <code>Page1</code> to <code>Page2</code> to <code>Page3</code> (in any order).</p>
  
  <p>What I need is; When each page is displayed, I need a command to be fired</p>
  
  <p>For instance:</p>
  
  <p>My 3 pages all have <code>DataGrids</code>.</p>
  
  <pre><code>mc:Ignorable="d"
    Title="Page1"&gt;
  
  &lt;DataGrid DataContext="{Binding Source={x:Static VM:ViewModel.Instance}}"
            ItemsSource="{Binding CustomerCollection, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
            RowDetailsVisibilityMode="VisibleWhenSelected"
            AutoGenerateColumns="True"&gt;
  
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>These DataGrids are bound to the same 'Customer' <code>ObservableCollection</code> in the same <code>(static)</code> <code>ViewModel</code>.</p>
  
  <pre><code>    public ObservableCollection&lt;customer&gt; CustomerCollection
      {
          get
          {
              return _customercollection;
          }
          set
          {
              _customercollection = value;
              OnPropertyChanged("CustomerCollection");
          }
      }
  </code></pre>
  
  <p>This means that at any given point in time, each page shows the same <code>Customer</code> information.</p>
  
  <p>Now I want <code>Page1</code> to show <strong>active Customers</strong>, <code>Page2</code> to show <strong>suspended Customers</strong>, and <code>Page3</code> to show <strong>resigned Customers</strong>.</p>
  
  <p>I need to fire different query in the <code>ViewModel</code> for each page. Each query is specific to <strong>page</strong>.</p>
  
  <p><strong>But how do I get this query to fire automatically as I navigate from page to page?</strong></p>
  
  <blockquote>
    <p>The idea here is to limit how much memory is in use when the
    application runs by recycling the same <code>ObservableCollections</code>.</p>
  </blockquote>