Beispiel #1
0
        protected override void UpdateSkinDisplayList()
        {
            if (null == Thumb || null == Track)
            {
                return;
            }

            var thumbRange = LayoutUtil.GetLayoutBoundsWidth(Track) - LayoutUtil.GetLayoutBoundsWidth(Thumb);
            var range      = Maximum - Minimum;

            // calculate new thumb position.
            var thumbPosTrackX = (range > 0) ? ((PendingValue - Minimum) / range) * thumbRange : 0;

            // convert to parent's coordinates.
            var thumbPos        = Track.LocalToGlobal(new Point(thumbPosTrackX, 0));
            var thumbPosParentX = Thumb.Parent.GlobalToLocal(thumbPos).X;

            Thumb.SetLayoutBoundsPosition(Mathf.Round(thumbPosParentX), LayoutUtil.GetLayoutBoundsY(Thumb));
        }
        //---------------------------------
        //  Utility methods for subclasses
        //---------------------------------

        /**
         *
         *
         * Utility method to calculate a skin part's position relative to our component.
         *
         * Param: part The skin part instance to obtain coordinates of.
         *
         * Returns: The component relative position of the part.
         */
        /// <summary>
        ///
        /// </summary>
        /// <param name="part"></param>
        /// <returns></returns>
        protected Point GetSkinPartPosition(IVisualElement part)
        {
            return((null == part || null == part.Parent) ? new Point(0, 0) :
                   GlobalToLocal(part.Parent.LocalToGlobal(new Point(LayoutUtil.GetLayoutBoundsX((InvalidationManagerClient)part), LayoutUtil.GetLayoutBoundsY((InvalidationManagerClient)part)))));
        }