MonoMobile.Views.ListSource.UpdateCell C# (CSharp) Method

UpdateCell() public method

public UpdateCell ( UITableViewCell cell, NSIndexPath indexPath ) : void
cell UITableViewCell
indexPath NSIndexPath
return void
		public override void UpdateCell(UITableViewCell cell, NSIndexPath indexPath)
		{	
			var composableListCell = cell as ComposableViewListCell;
			if (composableListCell != null)
			{
				composableListCell.IndexPath = indexPath;
			}
			
			Type dataType = null;
			var sectionData = GetSectionData(0);
			GetItems();
			
			if (sectionData.Count > 0)
			{
				dataType = sectionData[0].GetType();
			}

			if (DisplayMode != DisplayMode.RootCell)
			{
				if (dataType != null && (dataType.IsPrimitive || dataType.IsEnum) && (SelectionAction == SelectionAction.NavigateToView || SelectionAction == SelectionAction.Custom))
				{
					IsSelectable = false;
					SelectionAction = SelectionAction.Custom;
				}
			}
			else
			{
				if (dataType != null && ((dataType.IsPrimitive || dataType == typeof(string))) && (SelectionAction != SelectionAction.Custom || SelectionAction == SelectionAction.None))
				{
					IsNavigable = sectionData.Count > 1;
					SelectionAction = SelectionAction.Selection;

					if (sectionData.Count == 1)
					{
						SelectedItem = sectionData[0];
						SetItems();
					}
				}
			}

			base.UpdateCell(cell, indexPath);

			cell.SelectionStyle = IsNavigable ? UITableViewCellSelectionStyle.Blue : UITableViewCellSelectionStyle.None;  
			cell.SelectionStyle = IsSelectable ? UITableViewCellSelectionStyle.None : cell.SelectionStyle;  

			cell.SelectionStyle = SelectionAction == SelectionAction.Custom ? UITableViewCellSelectionStyle.Blue : cell.SelectionStyle;
			
			SetSelectionAccessory(cell, indexPath);

			cell.SetNeedsDisplay();
		}