public SolutionView(GlobalClass global)
        {
            if (global.Solution == null)
            {
                throw new BasicBlankException("No solution to even show");
            }
            if (global.Solution.Count != 4)
            {
                throw new BasicBlankException("Must have 4 for the solution");
            }
            StackPanel stack = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };

            //this can be larger because nothing else is showing now at this point.
            global.Solution.ForEach(bead =>
            {
                CirclePieceWPF <EnumColorPossibilities> thisControl = new CirclePieceWPF <EnumColorPossibilities>();
                thisControl.SetBinding(CirclePieceWPF <EnumColorPossibilities> .MainColorProperty, new Binding(nameof(Bead.UIColor)));
                thisControl.DataContext       = bead;
                thisControl.Height            = 250;
                thisControl.Width             = 250; //can experiment this time.
                thisControl.NeedsWhiteBorders = true;
                //thisControl.CommandParameter = bead;
                thisControl.Init();
                stack.Children.Add(thisControl);
            });
            Content = stack;
        }
Example #2
0
        public void PopulateControls(Guess guess)
        {
            _thisStack.Children.Clear();
            if (guess.YourBeads.Count == 0)
            {
                return; //maybe you don't need it at that moment (?)
                //throw new BasicBlankException("You need the 4.  Otherwise don't know anymore");
            }
            if (guess.YourBeads.Count != 4)
            {
                throw new BasicBlankException("Only 4 are supported");
            }
            guess.YourBeads.ForEach(bead =>
            {
                //we may have to manually add to the special list (?)
                CirclePieceWPF <EnumColorPossibilities> thisControl = new CirclePieceWPF <EnumColorPossibilities>();
                thisControl.SetBinding(CirclePieceWPF <EnumColorPossibilities> .MainColorProperty, new Binding(nameof(Bead.UIColor)));
                thisControl.DataContext       = bead;
                thisControl.Height            = GuessWidthHeight;
                thisControl.Width             = GuessWidthHeight;
                thisControl.NeedsWhiteBorders = true;
                thisControl.CommandParameter  = bead;
                thisControl.Init();


                //try to manually hook up this time
                //thisControl.Command =


                thisControl.Name = nameof(GameBoardViewModel.ChangeMind);
                GamePackageViewModelBinder.ManuelElements.Add(thisControl); //try this way.
                //Binding newBind = new Binding(nameof(HintChooserViewModel.ChangeMindCommand));
                //newBind.Source = _thisMod!.Guess1;
                //thisControl.SetBinding(CirclePieceWPF<EnumColorPossibilities>.CommandProperty, newBind);
                _thisStack.Children.Add(thisControl);
            });
        }