private void PieceBindings(ListPieceXF thisGraphics, ListViewPieceCP thisPiece) { thisGraphics.WidthRequest = ItemWidth; thisGraphics.HeightRequest = ItemHeight; // lets set to 20. thisGraphics.IsVisible = true; var thisBind = GetCommandBinding(nameof(ListViewPicker.ItemSelectedCommand)); thisGraphics.SetBinding(GraphicsCommand.CommandProperty, thisBind); thisGraphics.CommandParameter = thisPiece; // must be piece, not simply the color. something else will figure out the color. thisGraphics.Margin = new Thickness(5, 0, 5, 5); thisGraphics.BindingContext = thisPiece; thisGraphics.SetBinding(ListPieceXF.IsSelectedProperty, new Binding(nameof(BaseGraphicsCP.IsSelected))); // i think thisGraphics.SetBinding(IsEnabledProperty, new Binding(nameof(BaseGraphicsCP.IsEnabled))); thisGraphics.SetBinding(ListPieceXF.TextProperty, new Binding(nameof(ListViewPieceCP.DisplayText))); thisGraphics.SetBinding(ListPieceXF.IndexProperty, new Binding(nameof(ListViewPieceCP.Index))); thisGraphics.SendPiece(thisPiece); }
private void PopulateList() { if (TotalColumns == 0) { _thisStack !.Children.Clear(); } else { _thisGrid !.Children.Clear(); } int row = 0; int column = 0; foreach (var thisPiece in _textList !) { ListPieceXF thisGraphics = new ListPieceXF(); PieceBindings(thisGraphics, thisPiece); if (TotalColumns == 0) { _thisStack !.Children.Add(thisGraphics); } else { if (row + 1 > _thisGrid !.RowDefinitions.Count) { AddAutoRows(_thisGrid, 1); //add one as needed. } AddControlToGrid(_thisGrid !, thisGraphics, row, column); column++; if (column + 1 > TotalColumns) //try this way. { column = 0; row++; } } } }