コード例 #1
0
        private static void OnNumberOfItemsOnPathChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            d.CoerceValue(MinNumberOfItemsOnPathProperty);  //invokes the CoerceValueCallback delegate ("CoerceMinNumberOfItemsOnPath")
            d.CoerceValue(MaxNumberOfItemsOnPathProperty);  //invokes the CoerceValueCallback delegate ("CoerceMaxNumberOfItemsOnPath")
            CarouselControl depObj = (CarouselControl)d;

            depObj.pathListBox.LayoutPaths[0].Capacity = (double)depObj.NumberOfItemsOnPath;
        }
コード例 #2
0
        /// <summary>
        /// Coerce MaxNumberOfItemsOnPath value if not within limits
        /// </summary>
        private static object CoerceMaxNumberOfItemsOnPath(DependencyObject d, object value)
        {
            CarouselControl depObj = (CarouselControl)d;
            int             max    = (int)value;

            if (max < depObj.MinNumberOfItemsOnPath)
            {
                max = depObj.MinNumberOfItemsOnPath;
            }
            return(max);
        }
コード例 #3
0
        /// <summary>
        /// Coerce NumberOfItemsOnPath value if not within limits
        /// </summary>
        private static object CoerceNumberOfItemsOnPath(DependencyObject d, object value)
        {
            CarouselControl depObj  = (CarouselControl)d;
            int             current = (int)value;

            if (current < depObj.MinNumberOfItemsOnPath)
            {
                current = depObj.MinNumberOfItemsOnPath;
            }
            if (current > depObj.MaxNumberOfItemsOnPath)
            {
                current = depObj.MaxNumberOfItemsOnPath;
            }
            return(current);
        }