public void LoadTextList(CustomBasicList <string> thisList) { if (IndexMethod == EnumIndexMethod.Unknown) { throw new BasicBlankException("Must know the index method in order to continue"); } CustomBasicList <ListViewPieceCP> TempList = new CustomBasicList <ListViewPieceCP>(); int x; if (IndexMethod == EnumIndexMethod.OneBased) { x = 1; } else { x = 0; } foreach (var firstText in thisList) { ListViewPieceCP newText = new ListViewPieceCP(); newText.Index = x; newText.DisplayText = firstText; TempList.Add(newText); x += 1; } TextList.ReplaceRange(TempList); }
private async Task ProcessItemAsync(ListViewPieceCP piece) { SelectSpecificItem(piece.Index); if (ItemSelectedAsync == null) { return; } await ItemSelectedAsync.Invoke(piece.Index, piece.DisplayText); }
public void ShowOnlyOneSelectedItem(string text) { if (SelectionMode == EnumSelectionMode.MultipleItems) { throw new BasicBlankException("Must have single selection for showing one selected item"); } ListViewPieceCP thisPick = TextList.Single(Items => Items.DisplayText == text); TextList.ReplaceAllWithGivenItem(thisPick); //i think this is best. so a person see's just one item. //games like payday and maybe game of life does it this way. }
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); }
public void LoadTextList(CustomBasicList <string> thisList) { int x; x = 1; foreach (var firstText in thisList) { ListViewPieceCP newText = new ListViewPieceCP(); newText.Index = x; newText.DisplayText = firstText; newText.IsEnabled = true; TextList.Add(newText); //try this way. x += 1; } if (TextList.Count == 0) { throw new BasicBlankException("Failed to load text list"); } }
private async Task ProcessClickAsync(ListViewPieceCP piece) { if (SelectionMode == EnumSelectionMode.SingleItem) { SelectSpecificItem(piece.Index); } else if (piece.IsSelected) { piece.IsSelected = false; } else { piece.IsSelected = true; } if (ItemSelectedAsync == null) { return; //ignore because not there. } await ItemSelectedAsync.Invoke(piece.Index, piece.DisplayText); }