protected override void OnSizeRequested(ref Gtk.Requisition requisition) { // GUI designer automatically puts this widget into Viewport when property "Show Scrollbars" is set // necessary for automatic scroll support. // Need additional access in here to improve positioning when zooming. // cannot be initialized in constructor if (viewport == null) { viewport = (Gtk.Viewport) this.Parent; viewport.AddEvents((int)Gdk.EventMask.ScrollMask); // not called when scrollbar is being moved //viewport.ScrollAdjustmentsSet += Viewport_ScrollAdjustmentsSet; viewport.ScrollEvent += Viewport_ScrollEvent; ; } //var vr = viewport.Allocation; //Console.WriteLine ("Viewport size request Width={0} Height={1}", vr.Width, vr.Height); // Calculate desired size here. requisition.Width = minWidth; requisition.Height = minHeight; //Console.WriteLine ("OnSizeRequested -> Requisition: {0}x{1}", requisition.Width, requisition.Height); }