本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}