Well,

this.Root = root;

causes the Source to be recreated, which is where the UnevenRows thing
is set.  It's also handling the Scrolled event, I think.

I'm not sure how you get around it, but I think:

1. You create an uneven source (in Root = root;) then kill the Source
when you add the Scrolled event (adding an event will usually replace
any delegate - or source in this case - if thats where the event hooks
into)

2. You hook into the autogenerated delegate with your Scrolled +=
handleScrolled, but then the Root = root thing kills it.

I suggest that you override:

public virtual Source CreateSizingSource (bool unevenRows)
{
return unevenRows ? new SizingSource (this) : new Source (this);
}

and return your OWN Source / SizingSource. You one does it's own thing
in Scrolled, and I'd assume would do the same thing that SizingSource
does for size. The classes are public, so you might be able to:

public class MySource : DialogViewController.SizingSource
{
  public MySource(DialogViewController container) : base(container) {}
  public override void Scrolled (UIScrollView scrollView)
  {
    base.Scrolled(scrollView);
    //do your thing - maybe not even call the base!
  }

}

and

public override Source CreateSizingSource(bool unevenRows)
{
  return new MySource(this);
}

(and dont hook into TableView.Scrolled at all, BTW. If the scope on
the above doesn't work, you'll need to C+P the code out of github into
your own project)

BTW, the forums might be a better place for these - more people!


On 23 January 2013 15:47, vbisbest <[email protected]> wrote:
> I have a Monotouch.Dialog using plain style.  Uneven rows works well until I
> hook the Scrolled event.  Once I do that, uneven rows quits working.   If I
> Hook the Scrolled event before the UnevenRows property, then the UnevenRows
> works but the Scrolled event never fires.
>
> This makes UnevenRows not work but Scroll event fires:
> RootElement root = new RootElement("Messages");
> root.UnevenRows = true;
> root.Add(messageSection);
> this.Root = root;
> this.TableView.Scrolled += HandleScrolled;
>
> UneventRows works, but scroll event never fires:
> this.TableView.Scrolled += HandleScrolled;
> RootElement root = new RootElement("Messages");
> root.UnevenRows = true;
> root.Add(messageSection);
> this.Root = root;
>
> Any ideas?  Thanks,
> Ray
>
>
>
> --
> View this message in context: 
> http://monotouch.2284126.n4.nabble.com/Monotouch-Dialog-Issue-with-UnevenRows-and-Scrolled-Event-tp4657998.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch



--
Nic Wise
t.  +44 7788 592 806 | @fastchicken
b. http://www.fastchicken.co.nz/
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to