Exemplo n.º 1
0
        public void SetChild(IWidgetBackend child)
        {
            // Remove the old child before adding the new one
            // The child has to be removed from the viewport

            if (ScrollViewer.Content != null)
            {
                var port = (CustomScrollViewPort)ScrollViewer.Content;
                port.Children.Remove(port.Children[0]);
            }

            if (child == null)
            {
                return;
            }

            SetChildPlacement(child);
            ScrollAdjustmentBackend vbackend = null, hbackend = null;
            var widget = (WidgetBackend)child;

            if (widget.EventSink.SupportsCustomScrolling())
            {
                vscrollControl = vbackend = new ScrollAdjustmentBackend();
                hscrollControl = hbackend = new ScrollAdjustmentBackend();
            }
            ScrollViewer.Content          = new CustomScrollViewPort(widget.NativeWidget, vbackend, hbackend);
            ScrollViewer.CanContentScroll = true;

            if (vbackend != null)
            {
                widget.EventSink.SetScrollAdjustments(hbackend, vbackend);
            }
        }
Exemplo n.º 2
0
 public void SetOffset(ScrollAdjustmentBackend scroller, double offset)
 {
     if (scroller == verticalBackend)
     {
         SetVerticalOffset(offset);
     }
     else
     {
         SetHorizontalOffset(offset);
     }
 }
Exemplo n.º 3
0
        internal CustomScrollViewPort(object widget, ScrollAdjustmentBackend verticalBackend, ScrollAdjustmentBackend horizontalBackend)
        {
            if (widget == null)
                throw new ArgumentNullException ("widget");

            ((FrameworkElement)widget).RenderTransform = this.transform;

            if (verticalBackend != null) {
                usingCustomScrolling = true;
                verticalBackend.TargetViewport = this;
                this.verticalBackend = verticalBackend;
                horizontalBackend.TargetViewport = this;
                this.horizontalBackend = horizontalBackend;
                UpdateCustomExtent ();
            }
            Children.Add ((UIElement) widget);
        }
Exemplo n.º 4
0
        internal CustomScrollViewPort(object widget, ScrollAdjustmentBackend verticalBackend, ScrollAdjustmentBackend horizontalBackend)
        {
            if (widget == null)
            {
                throw new ArgumentNullException("widget");
            }

            ((FrameworkElement)widget).RenderTransform = this.transform;

            if (verticalBackend != null)
            {
                usingCustomScrolling             = true;
                verticalBackend.TargetViewport   = this;
                this.verticalBackend             = verticalBackend;
                horizontalBackend.TargetViewport = this;
                this.horizontalBackend           = horizontalBackend;
                UpdateCustomExtent();
            }
            Children.Add((UIElement)widget);
        }
Exemplo n.º 5
0
        public void SetChild(IWidgetBackend child)
        {
            // Remove the old child before adding the new one
            // The child has to be removed from the viewport

            if (ScrollViewer.Content != null) {
                var port = (CustomScrollViewPort)ScrollViewer.Content;
                port.Children.Remove (port.Children[0]);
            }

            if (child == null)
                return;

            ScrollAdjustmentBackend vbackend = null, hbackend = null;
            var widget = (WidgetBackend)child;

            if (widget.EventSink.SupportsCustomScrolling ()) {
                vbackend = new ScrollAdjustmentBackend ();
                hbackend = new ScrollAdjustmentBackend ();
            }
            ScrollViewer.Content = new CustomScrollViewPort (widget.NativeWidget, vbackend, hbackend);
            ScrollViewer.CanContentScroll = true;

            if (vbackend != null)
                widget.EventSink.SetScrollAdjustments (hbackend, vbackend);
        }
Exemplo n.º 6
0
 public void SetOffset(ScrollAdjustmentBackend scroller, double offset)
 {
     if (scroller == verticalBackend)
         SetVerticalOffset (offset);
     else
         SetHorizontalOffset (offset);
 }