protected virtual void OnItemClick(int index ,ExpandableItem item) { EventHandler<ExpandableItemClickEventArgs> handler = this.ItemClick; if (handler != null) { handler(this, new ExpandableItemClickEventArgs(index, item)); } }
public ExpandableItemClickEventArgs(int index, ExpandableItem item) { this.Index = index; this.Item = item; }
private void ValidateExpandableItem(ExpandableItem expandableItem) { if (expandableItem == null) { throw new ArgumentNullException("expandableItem", "You can't use a null instance of ExpandableItem as parameter."); } }
public void ConfigureButtonContent(View view, ExpandableItem expandableItem) { if (expandableItem.HasBackgroundId()) { int backgroundId = expandableItem.BackgroundId; view.SetBackgroundResource(backgroundId); } if (expandableItem.HasTitle()) { var button = view as Button; if (button==null) { return; } string text = expandableItem.Title; button.Text = text; } if (expandableItem.HasResourceId()) { var imageButton = view as ImageButton; if (imageButton== null) { return; } int resourceId = expandableItem.ResourceId; imageButton.SetImageResource(resourceId); } }
/// <summary> /// Changes the ExpandableItem associated to a given position and updates the Button widget to /// show the new ExpandableItem information. /// </summary> /// <param name="expandableItemPosition"></param> /// <param name="expandableItem"></param> public void UpdateExpandableItem(int expandableItemPosition, ExpandableItem expandableItem) { this.ValidateExpandableItem(expandableItem); this.ExpandableItems.RemoveAt(expandableItemPosition); this.ExpandableItems.Insert(expandableItemPosition, expandableItem); int buttonPosition = this._buttons.Count - 1 - expandableItemPosition; this.ConfigureButtonContent(this._buttons[buttonPosition], expandableItem); }
private void UpdateIconsFirstButtonResource(int resourceId) { var arrowUpExpandableItem = new ExpandableItem { ResourceId = resourceId }; this.IconsExpandableSelector.UpdateExpandableItem(0, arrowUpExpandableItem); }
private void SwipeFirstItem(int position, ExpandableItem clickedItem) { var firstItem = this.SizesExpandableSelector.ExpandableItems[0]; this.SizesExpandableSelector.UpdateExpandableItem(0, clickedItem); this.SizesExpandableSelector.UpdateExpandableItem(position, firstItem); }