private void PopulateList() { _thisStack !.Children.Clear(); foreach (var thisShape in _shapeList !) { XactikaPieceWPF thisGraphics = new XactikaPieceWPF(); PieceBindings(thisGraphics, thisShape); _thisStack.Children.Add(thisGraphics); } }
private void PieceBindings(XactikaPieceWPF thisGraphics, PieceCP thisPiece) { thisGraphics.Width = 90; thisGraphics.Height = 207; // use proportions (decided the aspect ratio as 1.5) thisGraphics.Margin = new Thickness(5, 0, 5, 5); // i do like the idea of margins this time as well. thisGraphics.Visibility = Visibility.Visible; // has to manually be set thisGraphics.DataContext = thisPiece; var thisBind = GetCommandBinding(nameof(ChooseShapeObservable.ShapeSelectedCommand)); thisGraphics.SetBinding(GraphicsCommand.CommandProperty, thisBind); thisGraphics.CommandParameter = thisPiece; // i think thisGraphics.SetBinding(XactikaPieceWPF.ShapeUsedProperty, nameof(PieceCP.ShapeUsed)); thisGraphics.SetBinding(XactikaPieceWPF.HowManyProperty, nameof(PieceCP.HowMany)); thisGraphics.SetBinding(XactikaPieceWPF.IsSelectedProperty, nameof(PieceCP.IsSelected)); thisGraphics.SetBinding(IsEnabledProperty, nameof(PieceCP.IsEnabled)); thisGraphics.SendPiece(thisPiece); // i think }