protected override Control GetControl(GameSpace thisItem, int index) { CheckerPiecesWPF thisC = new CheckerPiecesWPF(); thisC.DataContext = thisItem; thisC.Margin = new Thickness(0, 0, 5, 0); thisC.Height = 80; thisC.Width = 80; thisC.Name = nameof(SolitaireBoardGameMainViewModel.MakeMoveAsync); //not sure if my idea works. hopefully so. thisC.SetBinding(CheckerPiecesWPF.MainColorProperty, new Binding(nameof(GameSpace.Color))); thisC.SetBinding(CheckerPiecesWPF.HasImageProperty, new Binding(nameof(GameSpace.HasImage))); thisC.CommandParameter = thisItem; //try this. thisC.Init(); return(thisC); }
protected override Control GetControl(SpaceInfoCP thisItem, int index) { CheckerPiecesWPF output = new CheckerPiecesWPF(); output.DataContext = thisItem; output.Margin = new Thickness(0, 0, 5, 0); output.Height = 95; output.Width = 95; GamePackageViewModelBinder.ManuelElements.Add(output); //just in case. output.Name = nameof(ConnectFourMainViewModel.ColumnAsync); //output.SetBinding(CheckerPiecesWPF.CommandProperty, GetCommandBinding(nameof(ConnectFourViewModel.ColumnCommand))); output.SetBinding(CheckerPiecesWPF.MainColorProperty, new Binding(nameof(SpaceInfoCP.Color))); output.SetBinding(CheckerPiecesWPF.HasImageProperty, new Binding(nameof(SpaceInfoCP.HasImage))); output.BlankColor = cs.Aqua; output.CommandParameter = thisItem; output.Init(); // try this return(output); }