public void CreateReadOnly() { DecisionBox b = new DecisionBox(); DisplayPage = b; b.x_description.Text = Data.Description; if (Answer != null) { Answered(); } else { for (int i = 0; i < Data.Posibilities.Count; i++) { DecisionPossibilities s = Data.Posibilities[i]; Button bt = new Button(); Outcome o = Outcomes.Find(x => x.Id == s.Id); // this must be valid. Solved while loading System.Diagnostics.Debug.Assert(o != null); bt.Content = s.Action; bt.DataContext = s; bt.Click += Bt_Click; b.x_decisions.Children.Add(bt); } } }
public void Answered() { DecisionBox b = DisplayPage as DecisionBox; b.x_decisions.Visibility = System.Windows.Visibility.Collapsed; b.x_description.Text += "\n" + Answer.Reaction; }