I\'m re-writing my windows forms project that does scoring for sheep shearing events (don\'t ask, its a huge sport in New Zealand) from vbnet to wpf c# and have struck a problem
Your viewmodel defines a static method to get a single instance but you do not use it to instantiate it. Currently your viewmodel is being created with the default constructor which means the two windows will have separate copies.
Create your viewmodel in the code behind either below InitializeComponent or in the OnNavigatedToEvent.
Here's some code to explain further:
define a ViewModel property like so in both windows
property SheepViewModel ViewModel { get; set; }
Then your constructor:
public MainWindow()
{
InitializeComponent();
ViewModel = SheepViewModel.GetDetails(); // include this line
ScoreScreen SW = new ScoreScreen();
SW.Show();
}
also remove the
from the xaml as it's not required.