示例#1
0
        /// <summary>
        /// Called when a binding container value has been changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="BindingEventArgs"/> instance containing the event data.</param>
        protected virtual void OnBindingContainerValueChanged(object sender, BindingEventArgs e)
        {
            ActionThrottle throttle = null;

            if (_bindingThrottlers.TryGetValue(e.BindingProperty, out throttle))
            {
                throttle.ResetReplace(() =>
                {
                    RenderSingle(e.SkiaElement, e.BindingProperty.Mode);
                });
            }
        }
示例#2
0
        /// <summary>
        /// Should be called when the <see cref="SkiaHost.Child" /> is completely loaded.
        /// </summary>
        /// <param name="host">The Skia host.</param>
        public void Init(SkiaHost host)
        {
            _host = host;

            _scrolling_throttle   = new ActionThrottle(TimeSpan.FromMilliseconds(1000d / ScrollingFPS), _host.Dispatcher);
            _sizing_throttle      = new ActionThrottle(TimeSpan.FromMilliseconds(1000d / SizingFPS), _host.Dispatcher);
            _tree_change_throttle = new ActionThrottle(TimeSpan.FromMilliseconds(1000d / 30), _host.Dispatcher);

            _host.SizeChanged += _host_SizeChanged;
            _scrollViewer      = _host.FindAncestor <ScrollViewer>();

            if (_scrollViewer != null)
            {
                _scrollViewer.ScrollChanged += _scrollViewer_ScrollChanged;
                _scrollViewer.SizeChanged   += _scrollViewer_SizeChanged;
            }

            InitSurface();
            ReloadVisualTree();

            Render();
        }