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(); }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { if (state != null) { UITableViewCell cell = tableView.CellAt(indexPath); if (cell != null) { cell.SetNeedsDisplay(); } CharacterSelectionChangedEventArgs e = new CharacterSelectionChangedEventArgs(); e.OldCharacter = state._SelectedCharacter; state._SelectedCharacter = state.currentCharacters[indexPath.Row]; e.NewCharacter = state._SelectedCharacter; if (state.CharacterSelectionChanged != null) { state.CharacterSelectionChanged(state, e); } } }
public void ThemeChanged(UITableViewCell cell) { _Cell = cell; if (_Cell == null) { return; } if (_Cell.TextLabel != null) { if (TextFont != null) { _Cell.TextLabel.Font = TextFont; } _Cell.TextLabel.TextAlignment = TextAlignment; _Cell.TextLabel.TextColor = TextColor ?? _Cell.TextLabel.TextColor; if (TextShadowColor != null) { _Cell.TextLabel.ShadowColor = TextShadowColor; } if (TextShadowOffset != SizeF.Empty) { _Cell.TextLabel.ShadowOffset = TextShadowOffset; } if (TextHighlightColor != null) { _Cell.TextLabel.HighlightedTextColor = TextHighlightColor; } } if (_Cell.DetailTextLabel != null) { if (DetailTextFont != null) { _Cell.DetailTextLabel.Font = DetailTextFont; } _Cell.DetailTextLabel.TextAlignment = DetailTextAlignment; _Cell.DetailTextLabel.TextColor = DetailTextColor ?? _Cell.DetailTextLabel.TextColor; if (DetailTextShadowColor != null) { _Cell.DetailTextLabel.ShadowColor = DetailTextShadowColor; } if (DetailTextShadowOffset != SizeF.Empty) { _Cell.DetailTextLabel.ShadowOffset = DetailTextShadowOffset; } if (DetailTextHighlightColor != null) { _Cell.DetailTextLabel.HighlightedTextColor = DetailTextHighlightColor; } } if (CellBackgroundColor != null) { _Cell.BackgroundColor = CellBackgroundColor; } else if (CellBackgroundImage != null) { _Cell.BackgroundColor = UIColor.FromPatternImage(CellBackgroundImage); } else { _Cell.BackgroundColor = UIColor.White; } ConfigureBackgroundImage(); _Cell.SetNeedsDisplay(); }
public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath) { var updated = false; var sectionData = GetSectionData(0); var section = Sections[0]; if (section.Views.ContainsKey(cell)) { var views = section.Views[cell]; if (views.Count > 0) { foreach (var view in views) { var dc = view as IDataContext<object>; if (dc != null) { dc.DataContext = GetSectionData(0)[indexPath.Row]; } var updateable = view as IUpdateable; if (updateable != null) { updateable.UpdateCell(cell, indexPath); cell.SetNeedsDisplay(); updated = true; } } } } // Do default since no views have done an update if (!updated) { if (IsRootCell) { cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; cell.TextLabel.Text = Caption; if (IsMultiselect && cell.DetailTextLabel != null) { cell.DetailTextLabel.Text = SelectedItems.Count.ToString(); } else { if (SelectedItem != null) { if (ReplaceCaptionWithSelection) cell.TextLabel.Text = SelectedItem.ToString(); else if (cell.DetailTextLabel != null) cell.DetailTextLabel.Text = SelectedItem.ToString(); } } } else { if (sectionData.Count > 0 && sectionData[indexPath.Row] != null) { cell.TextLabel.AdjustsFontSizeToFitWidth = true; cell.TextLabel.Text = sectionData[indexPath.Row].ToString(); } else Console.WriteLine("No Data: for row {0}, section {1}", indexPath.Row, indexPath.Section); } } }
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(); }
public void ThemeChanged(UITableViewCell cell) { if (cell == null) return; if (cell.TextLabel != null) { if (TextFont != null) cell.TextLabel.Font = TextFont; cell.TextLabel.TextAlignment = TextAlignment; cell.TextLabel.TextColor = TextColor ?? cell.TextLabel.TextColor; if (TextShadowColor != null) cell.TextLabel.ShadowColor = TextShadowColor; if (TextShadowOffset != SizeF.Empty) cell.TextLabel.ShadowOffset = TextShadowOffset; if (TextHighlightColor != null) cell.TextLabel.HighlightedTextColor = TextHighlightColor; } if (cell.DetailTextLabel != null) { if (DetailTextFont != null) cell.DetailTextLabel.Font = DetailTextFont; cell.DetailTextLabel.TextAlignment = DetailTextAlignment; cell.DetailTextLabel.TextColor = DetailTextColor ?? cell.DetailTextLabel.TextColor; if (DetailTextShadowColor != null) cell.DetailTextLabel.ShadowColor = DetailTextShadowColor; if (DetailTextShadowOffset != SizeF.Empty) cell.DetailTextLabel.ShadowOffset = DetailTextShadowOffset; if (DetailTextHighlightColor != null) cell.DetailTextLabel.HighlightedTextColor = DetailTextHighlightColor; } var elementCell = cell as UITableViewElementCell; IImageUpdated element = null; if (elementCell != null) element = elementCell.Element as IImageUpdated; if (CellBackgroundColor != null) { cell.BackgroundColor = CellBackgroundColor ?? UIColor.White; } else if (element != null && CellBackgroundUri != null) { var img = ImageLoader.DefaultRequestImage(CellBackgroundUri, element); cell.BackgroundColor = img != null ? UIColor.FromPatternImage(img) : UIColor.White; } else if (CellBackgroundImage != null) { cell.BackgroundColor = UIColor.FromPatternImage(BackgroundImage); } else { cell.BackgroundColor = UIColor.White; } if (element != null && CellImageIconUri != null) { var img = ImageLoader.DefaultRequestImage(CellImageIconUri, element); if (img != null) { var small = img.Scale(new SizeF(32, 32)); small = small.RemoveSharpEdges(5); cell.ImageView.Image = small; cell.ImageView.Layer.MasksToBounds = false; cell.ImageView.Layer.ShadowOffset = new SizeF(2, 2); cell.ImageView.Layer.ShadowRadius = 2f; cell.ImageView.Layer.ShadowOpacity = 0.8f; } } else if (CellImageIcon != null) cell.ImageView.Image = CellImageIcon; if (Accessory.HasValue) cell.Accessory = Accessory.Value; else cell.Accessory = UITableViewCellAccessory.None; cell.SetNeedsDisplay(); }
public void ThemeChanged(UITableViewCell cell) { _Cell = cell; if (_Cell == null) { return; } if (_Cell.TextLabel != null) { if (TextFont != null) { _Cell.TextLabel.Font = TextFont; } _Cell.TextLabel.TextAlignment = TextAlignment; _Cell.TextLabel.TextColor = TextColor ?? _Cell.TextLabel.TextColor; if (TextShadowColor != null) { _Cell.TextLabel.ShadowColor = TextShadowColor; } if (TextShadowOffset != SizeF.Empty) { _Cell.TextLabel.ShadowOffset = TextShadowOffset; } if (TextHighlightColor != null) { _Cell.TextLabel.HighlightedTextColor = TextHighlightColor; } } if (_Cell.DetailTextLabel != null) { if (DetailTextFont != null) { _Cell.DetailTextLabel.Font = DetailTextFont; } _Cell.DetailTextLabel.TextAlignment = DetailTextAlignment; _Cell.DetailTextLabel.TextColor = DetailTextColor ?? _Cell.DetailTextLabel.TextColor; if (DetailTextShadowColor != null) { _Cell.DetailTextLabel.ShadowColor = DetailTextShadowColor; } if (DetailTextShadowOffset != SizeF.Empty) { _Cell.DetailTextLabel.ShadowOffset = DetailTextShadowOffset; } if (DetailTextHighlightColor != null) { _Cell.DetailTextLabel.HighlightedTextColor = DetailTextHighlightColor; } } if (CellBackgroundColor != null) { _Cell.BackgroundColor = CellBackgroundColor; } else if (CellBackgroundImage != null) { _Cell.BackgroundColor = UIColor.FromPatternImage(CellBackgroundImage); } else { _Cell.BackgroundColor = UIColor.White; } ConfigureBackgroundImage(); _Cell.SetNeedsDisplay(); }
public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath) { var updated = false; var sectionData = GetSectionData(0); var section = Sections[0]; if (section.Views.ContainsKey(cell)) { var views = section.Views[cell]; if (views.Count > 0) { foreach (var view in views) { var dc = view as IDataContext <object>; if (dc != null) { dc.DataContext = GetSectionData(0)[indexPath.Row]; } var updateable = view as IUpdateable; if (updateable != null) { updateable.UpdateCell(cell, indexPath); cell.SetNeedsDisplay(); updated = true; } } } } // Do default since no views have done an update if (!updated) { if (IsRootCell) { cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; cell.TextLabel.Text = Caption; if (IsMultiselect && cell.DetailTextLabel != null) { cell.DetailTextLabel.Text = SelectedItems.Count.ToString(); } else { if (SelectedItem != null) { if (ReplaceCaptionWithSelection) { cell.TextLabel.Text = SelectedItem.ToString(); } else if (cell.DetailTextLabel != null) { cell.DetailTextLabel.Text = SelectedItem.ToString(); } } } } else { if (sectionData.Count > 0 && sectionData[indexPath.Row] != null) { cell.TextLabel.AdjustsFontSizeToFitWidth = true; cell.TextLabel.Text = sectionData[indexPath.Row].ToString(); } else { Console.WriteLine("No Data: for row {0}, section {1}", indexPath.Row, indexPath.Section); } } } }