/// <summary>
        /// Handles changes to the ClipToBoundsHandler property.
        /// </summary>
        /// <param name="d">
        /// The <see cref="DependencyObject"/> on which
        /// the property has changed value.
        /// </param>
        /// <param name="e">
        /// Event data that is issued by any event that
        /// tracks changes to the effective value of this property.
        /// </param>
        private static void OnClipToBoundsHandlerChanged(
            DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ClipToBoundsHandler oldClipToBoundsHandler = (ClipToBoundsHandler)e.OldValue;
            ClipToBoundsHandler newClipToBoundsHandler = (ClipToBoundsHandler)d.GetValue(ClipToBoundsHandlerProperty);

            if (oldClipToBoundsHandler != null)
            {
                oldClipToBoundsHandler.Detach();
            }
            if (newClipToBoundsHandler != null)
            {
                newClipToBoundsHandler.Attach((FrameworkElement)d);
            }
        }
 public static void SetClipToBoundsHandler(DependencyObject d, ClipToBoundsHandler value)
 {
     d.SetValue(ClipToBoundsHandlerProperty, value);
 }