当前位置: 首页>>代码示例>>C#>>正文


C# Cell.GetType方法代码示例

本文整理汇总了C#中Xamarin.Forms.Cell.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Cell.GetType方法的具体用法?C# Cell.GetType怎么用?C# Cell.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Xamarin.Forms.Cell的用法示例。


在下文中一共展示了Cell.GetType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetCell

        /// <summary>
        /// Gets the cell.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="reusableCell">The reusable TableView cell.</param>
        /// <param name="tv">The TableView.</param>
        /// <returns>UITableViewCell.</returns>
        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
		{
			var extendedCell = (ExtendedTextCell)item;

			TextCell textCell = (TextCell)item;
			UITableViewCellStyle style = UITableViewCellStyle.Subtitle;
			if (extendedCell.DetailLocation == TextCellDetailLocation.Right)
				style = UITableViewCellStyle.Value1;

			string fullName = item.GetType ().FullName;
			CellTableViewCell cell = tv.DequeueReusableCell (fullName) as CellTableViewCell;
			if (cell == null) {
				cell = new CellTableViewCell (style, fullName);
			}
			else {
				cell.Cell.PropertyChanged -= new PropertyChangedEventHandler (cell.HandlePropertyChanged);
			}
			cell.Cell = textCell;
			textCell.PropertyChanged += new PropertyChangedEventHandler (cell.HandlePropertyChanged);
			cell.PropertyChanged = new Action<object, PropertyChangedEventArgs> (HandlePropertyChanged);
			cell.TextLabel.Text = textCell.Text;
			cell.DetailTextLabel.Text = textCell.Detail;
			cell.TextLabel.TextColor = textCell.TextColor.ToUIColor (DefaultTextColor);
			cell.DetailTextLabel.TextColor = textCell.DetailColor.ToUIColor (DefaultDetailColor);

			UpdateBackground (cell, item);

			if (cell != null) {
				cell.BackgroundColor = extendedCell.BackgroundColor.ToUIColor ();
				cell.SeparatorInset = new UIEdgeInsets ((float)extendedCell.SeparatorPadding.Top, (float)extendedCell.SeparatorPadding.Left,
					(float)extendedCell.SeparatorPadding.Bottom, (float)extendedCell.SeparatorPadding.Right);

				if (extendedCell.ShowDisclousure) {
					cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
					if (!string.IsNullOrEmpty (extendedCell.DisclousureImage)) {
						var detailDisclosureButton = UIButton.FromType (UIButtonType.Custom);
						detailDisclosureButton.SetImage (UIImage.FromBundle (extendedCell.DisclousureImage), UIControlState.Normal);
						detailDisclosureButton.SetImage (UIImage.FromBundle (extendedCell.DisclousureImage), UIControlState.Selected);

						detailDisclosureButton.Frame = new CGRect (0f, 0f, 30f, 30f);
						detailDisclosureButton.TouchUpInside += (object sender, EventArgs e) => {
							var index = tv.IndexPathForCell (cell);
							tv.SelectRow (index, true, UITableViewScrollPosition.None);
							tv.Source.AccessoryButtonTapped (tv, index);
						};
						cell.AccessoryView = detailDisclosureButton;
					}
				}
			}

			if(!extendedCell.ShowSeparator)
				tv.SeparatorStyle = UITableViewCellSeparatorStyle.None;

			tv.SeparatorColor = extendedCell.SeparatorColor.ToUIColor();

			return cell;
		}
开发者ID:nrogoff,项目名称:Xamarin-Forms-Labs,代码行数:64,代码来源:ExtendedTextCellRenderer.cs

示例2: GetCell

 public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
 {
     var tvc = reusableCell as CellTableViewCell;
     if (tvc == null) {
         tvc = new CellTableViewCell (UITableViewCellStyle.Value1, item.GetType().FullName);
     }
     tvc.Cell = item;
     var cell = base.GetCell(item, tvc, tv);
     cell.SetDisclosure(item.StyleId);
     return cell;
 }
开发者ID:RobGibbens,项目名称:app-evolve,代码行数:11,代码来源:TextViewValue1Renderer.cs

示例3: GetCell

        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
        {
            cellId = cellId ?? new NSString (item.GetType ().FullName);
            var cellCache = FastCellCache.Instance.GetCellCache (tv);
            var fastCell = item as FastCell;
            var nativeCell = reusableCell as NativeCell;

            if (reusableCell != null && cellCache.IsCached (nativeCell, fastCell.ReuseIdentifier)) {
                cellCache.RecycleCell (nativeCell, fastCell);
            } else {
                var newCell = (FastCell)Activator.CreateInstance (item.GetType ());
                newCell.BindingContext = item.BindingContext;
                newCell.Parent = item.Parent;

                if (!newCell.IsInitialized) {
                    newCell.PrepareCell ();
                }
                nativeCell = new NativeCell (cellId, newCell);
                cellCache.CacheCell (newCell, nativeCell);
            }
            return nativeCell;
        }
开发者ID:schmidan,项目名称:TwinTechsFormsLib,代码行数:22,代码来源:FastCellRenderer.cs

示例4: GetCell

        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
        {
            cellId = cellId ?? new NSString (item.GetType ().FullName);
            var nativeCell = reusableCell as NativeCell;
            var viewCell = item as FastCell;

            Device.BeginInvokeOnMainThread (new Action (viewCell.SendAppearing));

            if (reusableCell == null) {
                nativeCell = new NativeCell (cellId, viewCell);
            } else {
                nativeCell.RecycleCell (viewCell);
            }

            return nativeCell;
        }
开发者ID:paulpatarinski,项目名称:ModernDirectory,代码行数:16,代码来源:FastCellRenderer.cs

示例5: GetCell

        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
        {
            cellId = cellId ?? new NSString (item.GetType ().FullName);
            var cellCache = FastCellCache.Instance.GetCellCache (tv);
            var fastCell = item as FastCell;
            var nativeCell = reusableCell as NativeCell;

            if (reusableCell != null && cellCache.IsCached (nativeCell)) {
                cellCache.RecycleCell (nativeCell, fastCell);
            } else {
                if (!fastCell.IsInitialized) {
                    fastCell.PrepareCell ();
                }
                nativeCell = new NativeCell (cellId, fastCell);
                cellCache.CacheCell (fastCell, nativeCell);
            }
            return nativeCell;
        }
开发者ID:Strykeforce01,项目名称:TwinTechsFormsLib,代码行数:18,代码来源:FastCellRenderer.cs

示例6: GetCell

        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
        {
            EntryCellEx entryCell = (EntryCellEx)item;
            EntryCellTableViewCell entryCellTableViewCell = reusableCell as EntryCellTableViewCell;
            if (entryCellTableViewCell != null)
            {
                entryCellTableViewCell.Cell.PropertyChanged -= OnCellPropertyChanged;
                entryCellTableViewCell.TextFieldTextChanged -= OnTextFieldTextChanged;
                entryCellTableViewCell.KeyboardDoneButtonPressed -= OnKeyBoardDoneButtonPressed;

                var oldCell = entryCellTableViewCell.Cell as EntryCellEx;
                if (oldCell != null)
                {
                    oldCell.FocusRequested -= EntryCell_FocusRequested;
                }
            }
            else
            {
                entryCellTableViewCell = new EntryCellTableViewCell(item.GetType().FullName);
            }

            SetMyRealCell(item, entryCellTableViewCell);
            entryCellTableViewCell.Cell = item;
            entryCellTableViewCell.Cell.PropertyChanged += OnCellPropertyChanged;
            entryCell.FocusRequested += EntryCell_FocusRequested;
            entryCellTableViewCell.TextFieldTextChanged += OnTextFieldTextChanged;
            entryCellTableViewCell.KeyboardDoneButtonPressed += OnKeyBoardDoneButtonPressed;
            base.UpdateBackground(entryCellTableViewCell, entryCell);
            UpdateLabel(entryCellTableViewCell, entryCell);
            UpdateText(entryCellTableViewCell, entryCell);
            UpdateKeyboard(entryCellTableViewCell, entryCell);
            UpdatePlaceholder(entryCellTableViewCell, entryCell);
            UpdateLabelColor(entryCellTableViewCell, entryCell);
            UpdateXAlign(entryCellTableViewCell, entryCell);
            UpdateIsEnabled(entryCellTableViewCell, entryCell);

            if (entryCell.RequestInitialFocus)
            {
                entryCellTableViewCell.TextField.BecomeFirstResponder();
                entryCell.RequestInitialFocus = false;
            }

            return entryCellTableViewCell;
        }
开发者ID:TheAlmightyBob,项目名称:TripSketch,代码行数:44,代码来源:EntryCellRendererEx.cs

示例7: GetCellCore

        //TODO add a lookup for the cells we piggy back of.
        protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
        {
            var cellCache = FastCellCache.Instance.GetCellCache (parent);
            var fastCell = item as FastCell;

            Android.Views.View cellCore = convertView;

            if (cellCore != null && cellCache.IsCached (cellCore)) {
                cellCache.RecycleCell (cellCore, fastCell);
            } else {
                var newCell = (FastCell) Activator.CreateInstance (item.GetType ());
                newCell.BindingContext = item.BindingContext;
                newCell.Parent = item.Parent;

                if (!newCell.IsInitialized) {
                    newCell.PrepareCell ();
                }
                cellCore = base.GetCellCore (newCell, convertView, parent, context);
                cellCache.CacheCell (newCell, cellCore);
            }
            return cellCore;
        }
开发者ID:MammothAU,项目名称:TwinTechsFormsLib,代码行数:23,代码来源:FastCellRenderer.cs


注:本文中的Xamarin.Forms.Cell.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。