public MainWindow() { InitializeComponent(); diceRollerVM = new DiceRollerViewModel(); diceRoller.DataContext = diceRollerVM; //scoreSheet.DataContext = new ScoreSheetViewModel(new ScoreSheet(),diceRollerVM); }
public RollCommand(DiceRollerViewModel drvm) { viewModel = drvm; // Call CanExecuteChanged whenever CanRoll changes viewModel.CanRoll.PropertyChanged += (sender, args) => { if (CanExecuteChanged != null) { CanExecuteChanged(this, new EventArgs()); } }; }
public ScoreSheetViewModel(ScoreSheet scoreSheet, DiceRollerViewModel diceRollerViewModel) { this.diceRollerViewModel = diceRollerViewModel; this.scoreSheet = scoreSheet; scoreLines = new List <ScoreLineViewModel>(); List <ScoreLineViewModel> _scoreLines = new List <ScoreLineViewModel>(); foreach (ScoreLine scoreLine in this.scoreSheet.ScoreLines) { _scoreLines.Add(new ScoreLineViewModel(scoreLine)); } scoreLines = _scoreLines.AsReadOnly(); }