コード例 #1
0
        protected override Android.Views.View GetCellCore(Cell item,
                                                          Android.Views.View convertView,
                                                          ViewGroup parent,
                                                          Context context)
        {
            _cellCore = base.GetCellCore(item, convertView, parent, context);
            try
            {
                _selected = ((Menus)item.BindingContext).isSelected;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }

            _unselectedBackground = _cellCore.Background;

            if (_selected)
            {
                ExtendedViewCell extendedViewCell = item as ExtendedViewCell;
                _cellCore.SetBackgroundColor(extendedViewCell.SelectedBackgroundColor.ToAndroid());
            }
            else
            {
                ExtendedViewCell extendedViewCell = item as ExtendedViewCell;
                _cellCore.SetBackgroundColor(Color.White.ToAndroid());
            }

            return(_cellCore);
        }
コード例 #2
0
 private void SetDiscolosure(ExtendedViewCell extendedCell, UITableViewCell cell)
 {
     if (extendedCell.ShowDisclosure)
     {
         cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
         if (!string.IsNullOrEmpty(extendedCell.DisclosureImage))
         {
             var detailDisclosureButton = UIButton.FromType(UIButtonType.Custom);
             detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclosureImage), UIControlState.Normal);
             detailDisclosureButton.SetImage(UIImage.FromBundle(extendedCell.DisclosureImage), UIControlState.Selected);
             detailDisclosureButton.Frame          = new CGRect(0f, 0f, 30f, 30f);
             detailDisclosureButton.TouchUpInside += (sender, e) =>
             {
                 try
                 {
                     var index = _tableView.IndexPathForCell(cell);
                     _tableView.SelectRow(index, true, UITableViewScrollPosition.None);
                     _tableView.Source.RowSelected(_tableView, index);
                 }
                 catch (You_Should_Not_Call_base_In_This_Method)
                 {
                     Console.Write("Xamarin Forms Labs Weird stuff : You_Should_Not_Call_base_In_This_Method happend");
                 }
             };
             cell.AccessoryView = detailDisclosureButton;
         }
     }
     else
     {
         cell.Accessory     = UITableViewCellAccessory.None;
         cell.AccessoryView = null;
     }
 }