예제 #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);
            }
        }
예제 #2
0
 public void SetOffset(ScrollAdjustmentBackend scroller, double offset)
 {
     if (scroller == verticalBackend)
     {
         SetVerticalOffset(offset);
     }
     else
     {
         SetHorizontalOffset(offset);
     }
 }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #6
0
 public void SetOffset(ScrollAdjustmentBackend scroller, double offset)
 {
     if (scroller == verticalBackend)
         SetVerticalOffset (offset);
     else
         SetHorizontalOffset (offset);
 }