Example #1
0
        /// <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);
            }
        }
Example #2
0
 /// <summary>
 /// Sets the ClipToBoundsHandler property. This dependency property
 /// indicates the handler that handles the updates to the clipping geometry when ClipToBounds is set to true.
 /// </summary>
 public static void SetClipToBoundsHandler(DependencyObject d, ClipToBoundsHandler value)
 {
     d.SetValue(ClipToBoundsHandlerProperty, value);
 }