[MonoTouch] Custom RootElement showing up blank

Jeff Stedfast jeff at xamarin.com
Fri Oct 14 12:19:45 EDT 2011


Hi Brian,

By overriding RootElement's GetCell(), RootElement doesn't get a chance to
populate the cell's fields.

Hope that helps,

Jeff

On Thu, Oct 13, 2011 at 11:53 PM, brinew27 <briannewton at gmail.com> wrote:

> Hey guys,
>
> Any idea why this code would produce a blank rootelement in my table when
> passing in an Alert object and a string, when if I just use a basic
> RootElement and pass a string for caption it works fine?
>
> public class AlertRootElement : RootElement {
>             static NSString key = new NSString ("alertRootElement");
>             public EbayNotifierService.Alert Alert;
>
>             public AlertRootElement (EbayNotifierService.Alert alert,
> string
> caption) : base (caption)
>             {
>                  Alert = alert;
>             }
>
>             public override UITableViewCell GetCell (UITableView tv)
>             {
>                  var cell = tv.DequeueReusableCell (key) as AlertDataCell;
>                  if (cell == null)
>                       cell = new AlertDataCell (Alert, key);
>                  else
>                       cell.UpdateCell (Alert);
>                  return cell;
>             }
>
>             public void Delete() {
>                 Console.WriteLine(String.Format("Deleting record {0}",
> Alert));
>
>                        EbayNotifierService.EbayNotifier ebayNotifierService
> = new
> EbayNotifierService.EbayNotifier();
>
>  ebayNotifierService.DeactivateAlertAndItems(Alert.AlertID);
>             }
>        }
>
> --
> View this message in context:
> http://monotouch.2284126.n4.nabble.com/Custom-RootElement-showing-up-blank-tp3903751p3903751.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20111014/867e0b03/attachment.html 


More information about the MonoTouch mailing list