title: Value I'm trying to get is always null
body: <p>In my application I'm using a ribbon control, on this ribbon is a button.
  When I click the button it should get the selected value from the datagrid in my view.</p>
  
  <p>Now when I click the button the value it gets is always <code>null</code>.</p>
  
  <p>This is my code:</p>
  
  <p><strong>View1.xaml</strong></p>
  
  <pre><code>&lt;ScrollViewer Background="White" Grid.Row="1" Grid.Column="1" Margin="2" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Visible"&gt;
      &lt;DataGrid SelectionMode="Single" ItemsSource="{Binding Collection}" SelectedItem="{Binding Test, Mode=TwoWay}" AutoGenerateColumns="False" Name="stackpanelLocked"  HorizontalAlignment="Left"&gt;
          &lt;DataGrid.Columns&gt;
              &lt;DataGridTextColumn Header="RandomHeaderX" Binding="{Binding Path=X}"/&gt;
              &lt;DataGridTextColumn Header="RandomHeaderY" Binding="{Binding Path=Y}"/&gt;
          &lt;/DataGrid.Columns&gt;
      &lt;/DataGrid&gt;
  &lt;/ScrollViewer&gt;
  </code></pre>
  
  <p><strong>Viewmodel</strong></p>
  
  <pre><code>//get selected item value
  string lastSelectedValue;
  private Model _test;        
  public Model Test 
  {
      get
      {
          return _test;
      }
      set
      {
          _test = value;
          if(Test != null)
              this.lastSelectedValue = string.Format("Variabele X: {0} Variabele Y: {1}", Test.X, Test.Y);
      }
  }
  
  private ICommand _ClickCommand;
  public ICommand ClickCommand
  {
      get
      {
          if (_ClickCommand == null)
              _ClickCommand = new DelegateCommand(new Action(Execute),
                          new Func&lt;bool&gt;(CanExecute));
          return _ClickCommand;
      }
  }
  
  public bool CanExecute()
  {
      return true;
  }
  
  public void Execute()
  {
      if(lastSelectedValue != null)
          Clipboard.SetText(lastSelectedValue);  
  }
  </code></pre>
  
  <p><strong>Model</strong></p>
  
  <pre><code>public int X { get; set; }
  public int Y { get; set; }
  
  public Model(int x, int y)
  {
      X = x;
      Y = y;
  }
  </code></pre>
  
  <p>Extra info:</p>
  
  <p>Every time I click in the datagrid it will actually fill the <code>string</code> <code>lastSelectedValue</code>.
  But when I click the button on the ribbon it will say that the <code>lastSelectedValue</code> is  null.</p>
  
  <p><strong>Collection stuff:</strong></p>
  
  <pre><code>public List&lt;DatabaseClass.coord&gt; AllCoords { get; set; }
  public ObservableCollection&lt;Model&gt; Collection { get; set; }
  public ModuleARibbonTabModel()
  {
      Collection = new ObservableCollection&lt;Model&gt;();
      GenerateDatas();
  }
  
  private void GenerateDatas()
  {
      using (var ctx = new DatabaseClass.TestDatabaseEntities1 ())
      {
          AllCoords = ctx.coord.ToList();
      }
      foreach(DatabaseClass.coord f in AllCoords)
      {
          Collection.Add(new Model(Convert.ToInt32(f.Een.ToString()), Convert.ToInt32(f.Twee.ToString())));
      }
  }
  </code></pre>