本文整理汇总了C#中Xamarin.Forms.Cell类的典型用法代码示例。如果您正苦于以下问题:C# Cell类的具体用法?C# Cell怎么用?C# Cell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Cell类属于Xamarin.Forms命名空间,在下文中一共展示了Cell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCell
public override UIKit.UITableViewCell GetCell(Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
{
var cell = base.GetCell(item, reusableCell, tv);
cell.SelectionStyle = UIKit.UITableViewCellSelectionStyle.None;
return cell;
}
示例2: GetCellCore
protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Context context)
{
var cell = (LinearLayout)base.GetCellCore(item, convertView, parent, context);
var image = (ImageView)cell.GetChildAt(0);
image.SetScaleType(ImageView.ScaleType.CenterCrop);
return cell;
}
示例3: GetCell
public override UIKit.UITableViewCell GetCell (Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv)
{
var cell = base.GetCell (item, reusableCell, tv);
cell.SeparatorInset = UIEdgeInsets.Zero;
cell.TextLabel.Font = UIFont.FromName ("baskervillebecker", 18f);
return cell;
}
示例4: GetCell
public override UITableViewCell GetCell (Cell item, UITableView tv)
{
var viewModel = (AgendaCellViewModel)item.BindingContext;
var cellTableViewCell = tv.DequeueReusableCell ("cell") as CellTableViewCell
?? new CellTableViewCell (UITableViewCellStyle.Default, "cell");
cellTableViewCell.Cell = item;
cellTableViewCell.SelectionStyle = UITableViewCellSelectionStyle.None;
var textColor = ((Xamarin.Forms.Color)new TrackTextColorConverter ()
.Convert (viewModel.Track, typeof(Xamarin.Forms.Color),
null, CultureInfo.CurrentCulture))
.ToUIColor ();
cellTableViewCell.AddSubview (CreateBackgroundView (cellTableViewCell.Bounds, viewModel));
if (viewModel.IsBooked) {
cellTableViewCell.AddSubview (CreateTitleLabel (viewModel, textColor));
cellTableViewCell.AddSubview (CreateLocationLabel (viewModel, textColor));
cellTableViewCell.AddSubview (CreateTrackLabel (viewModel, textColor));
} else {
cellTableViewCell.AddSubview (CreateChooseLabel ());
cellTableViewCell.AddSubview (CreateAddIcon ());
}
cellTableViewCell.AddSubview (CreateTimeLabel (viewModel, textColor));
cellTableViewCell.AddSubview (CreateAMPMLabel (viewModel, textColor));
this.UpdateBackground (cellTableViewCell, item);
return cellTableViewCell;
}
示例5: GetCellCore
protected override View GetCellCore(Cell item, View convertView, ViewGroup parent, Context context)
{
var inflatorservice = (LayoutInflater)Forms.Context.GetSystemService(Android.Content.Context.LayoutInflaterService);
var dataContext = item.BindingContext as EventViewModel;
var textMsgVm = dataContext as TextMessageViewModel;
if (textMsgVm != null)
{
if (textMsgVm.ImageId.HasValue)
{
var template = (LinearLayout)inflatorservice.Inflate(textMsgVm.IsMine ? Resource.Layout.image_item_owner : Resource.Layout.image_item_opponent, null, false);
//template.FindViewById<TextView>(Resource.Id.timestamp).Text = textMsgVm.Timestamp.ToString("HH:mm");
template.FindViewById<TextView>(Resource.Id.nick).Text = textMsgVm.IsMine ? "Me:" : textMsgVm.AuthorName + ":";
template.FindViewById<ImageView>(Resource.Id.image).SetImageBitmap(GetImageBitmapFromUrl(textMsgVm.ImageUrl));
return template;
}
else
{
var template = (LinearLayout)inflatorservice.Inflate(textMsgVm.IsMine ? Resource.Layout.message_item_owner : Resource.Layout.message_item_opponent, null, false);
//template.FindViewById<TextView>(Resource.Id.timestamp).Text = textMsgVm.Timestamp.ToString("HH:mm");
template.FindViewById<TextView>(Resource.Id.nick).Text = textMsgVm.IsMine ? "Me:" : textMsgVm.AuthorName + ":";
template.FindViewById<TextView>(Resource.Id.message).Text = textMsgVm.Text;
return template;
}
}
return base.GetCellCore(item, convertView, parent, context);
}
示例6: GetCell
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
{
var viewCell = (ViewCellExtended)item;
var cell = base.GetCell(item, reusableCell, tv);
if (cell != null)
{
cell.SelectionStyle = viewCell.IsHighlightSelection ? UITableViewCellSelectionStyle.Default : UITableViewCellSelectionStyle.None;
if (viewCell.SelectColor != Color.Transparent)
{
if (selView == null)
{
selView = new UIView(cell.SelectedBackgroundView.Bounds);
selView.BackgroundColor = new UIColor((nfloat)viewCell.SelectColor.R, (nfloat)viewCell.SelectColor.G, (nfloat)viewCell.SelectColor.B, (nfloat)viewCell.SelectColor.A);
//selView.Layer.BackgroundColor = UIColor.Blue;
//selView.Layer.BorderColor = UIColor.Yellow;
//selView.Layer.BorderWidth = 2.0f;
}
cell.SelectedBackgroundView = selView;
}
}
return cell;
}
示例7: GetCellCore
protected override View GetCellCore (Cell item, View convertView, ViewGroup parent, Context context)
{
var cell = (LinearLayout)base.GetCellCore (item, convertView, parent, context);
cell.SetPadding(20, 10, 0, 10);
cell.DividerPadding = 50;
var div = new ShapeDrawable();
div.SetIntrinsicHeight(1);
//div.Paint.Set(new Paint { Color = Color.FromHex("00FFFFFF").ToAndroid() });
if (parent is ListView) {
((ListView)parent).Divider = div;
((ListView)parent).DividerHeight = 1;
}
var label = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(0);
label.SetTextColor(Color.FromHex("000000").ToAndroid());
label.TextSize = Font.SystemFontOfSize(NamedSize.Large).ToScaledPixel();
var secondaryLabel = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(1);
secondaryLabel.SetTextColor(Color.FromHex("738182").ToAndroid());
secondaryLabel.TextSize = Font.SystemFontOfSize(NamedSize.Medium).ToScaledPixel();
return cell;
}
示例8: GetCellCore
protected override View GetCellCore (Cell item, View convertView, ViewGroup parent, Context context)
{
var cell = (LinearLayout)base.GetCellCore (item, convertView, parent, context);
cell.SetPadding(20, 10, 0, 10);
cell.DividerPadding = 50;
var div = new ShapeDrawable();
div.SetIntrinsicHeight(1);
div.Paint.Set(new Paint { Color = MobileCRM.Shared.Helpers.AppColors.SEPARATOR.ToAndroid() });
if (parent is ListView) {
((ListView)parent).Divider = div;
((ListView)parent).DividerHeight = 1;
}
var label = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(0);
label.SetTextColor(MobileCRM.Shared.Helpers.AppColors.LABELWHITE.ToAndroid());
label.TextSize = Font.SystemFontOfSize(NamedSize.Large).ToScaledPixel();
var secondaryLabel = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(1);
secondaryLabel.SetTextColor(MobileCRM.Shared.Helpers.AppColors.LABELBLUE.ToAndroid());
secondaryLabel.TextSize = Font.SystemFontOfSize(NamedSize.Medium).ToScaledPixel();
return cell;
}
示例9: GetCell
public override UIKit.UITableViewCell GetCell(Cell item, UIKit.UITableViewCell reusableCell,
UIKit.UITableView tv)
{
var cell = base.GetCell(item, reusableCell, tv);
cell.Accessory = CellAccessoryHelper.GetCellAccessory(item.StyleId);
return cell;
}
示例10: GetCellCore
protected override View GetCellCore (Cell item, View convertView, ViewGroup parent, Context context)
{
var cell = (LinearLayout)base.GetCellCore(item, convertView, parent, context);
cell.SetPadding(20, 30, 0, 30);
cell.DividerPadding = 50;
var div = new ShapeDrawable();
div.SetIntrinsicHeight(1);
div.Paint.Set(new Paint { Color = Color.FromHex("00FFFFFF").ToAndroid() });
if (parent is ListView)
{
((ListView)parent).Divider = div;
((ListView)parent).DividerHeight = 1;
}
var image = (ImageView)cell.GetChildAt(0);
image.SetScaleType(ImageView.ScaleType.FitCenter);
image.LayoutParameters.Width = 60;
image.LayoutParameters.Height = 60;
var linear = (LinearLayout)cell.GetChildAt(1);
linear.SetGravity(GravityFlags.CenterVertical);
var label = (TextView)linear.GetChildAt(0);
label.SetTextColor(Color.White.ToAndroid());
label.TextSize = Font.SystemFontOfSize(NamedSize.Medium).ToScaledPixel() * 1.25f;
label.Gravity = (GravityFlags.CenterVertical);
label.SetTextColor(Color.FromHex("FFFFFF").ToAndroid());
var secondaryLabel = (TextView)linear.GetChildAt(1);
secondaryLabel.Visibility = ViewStates.Gone;
return cell;
}
示例11: GetCellCore
protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context)
{
var cell = (TextLabelCell)item;
var view = convertView;
if (view == null) {
view = (context as Activity).LayoutInflater.Inflate(Resource.Layout.cell, null);
}
TextView label = (Android.Widget.TextView)view.FindViewById (Resource.Id.textLabel);
label.Text = cell.Label;
label.SetTextColor (cell.LabelColor.ToAndroid ());
if (cell.XAlign == Xamarin.Forms.TextAlignment.Center) {
label.Gravity = GravityFlags.Center;
}
// Detail on the right
TextView DetailText = (Android.Widget.TextView) view.FindViewById (Resource.Id.detailTextLabel);
if (cell.Text != null)
DetailText.Text = cell.Text;
else
DetailText.Visibility = Android.Views.ViewStates.Invisible;
view.SetBackgroundColor (cell.BackgroundColor.ToAndroid ());
return view;
}
示例12: GetCellCore
protected override Android.Views.View GetCellCore (Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context) {
var cell = (LinearLayout)base.GetCellCore (item, convertView, parent, context);
var label = (TextView)((LinearLayout)cell.GetChildAt(1)).GetChildAt(0);
Typeface font = Typeface.CreateFromAsset (Forms.Context.Assets, "HelveticaTEDBold.otf");
label.Typeface = font;
return cell;
}
示例13: GetCell
public override UITableViewCell GetCell(Cell item, UITableView tv)
{
var extendedCell = (ExtendedViewCell)item;
var cell = base.GetCell (item, tv);
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 = MonoTouch.UIKit.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 RectangleF (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;
}
示例14: GetCell
// Get the cell and add the disclosure indicator if the bindable property was set to true.
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
{
var cell = base.GetCell (item, reusableCell, tv);
if( ( (DisclosureImageCell) item ).DisclosureEnabled)
cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
return cell;
}
示例15: GetCell
public override UITableViewCell GetCell (Cell item, UITableViewCell reusableCell, UITableView tv)
{
var extendedCell = (ExtendedViewCell) item;
_tableView = _tableView ?? tv;
var cell = base.GetCell(item, reusableCell, tv);
if (cell != null)
{
cell.SelectionStyle = extendedCell.HighlightSelection ? UITableViewCellSelectionStyle.Default : UITableViewCellSelectionStyle.None;
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);
SetDiscolosure(extendedCell, cell);
if (!_cellMappings.ContainsKey(extendedCell))
extendedCell.PropertyChanged += ExtendedCellOnPropertyChanged;
_cellMappings[extendedCell] = cell;
}
if (!extendedCell.ShowSeparator)
tv.SeparatorStyle = UITableViewCellSeparatorStyle.None;
tv.SeparatorColor = extendedCell.SeparatorColor.ToUIColor();
return cell;
}