예제 #1
0
        /// <summary>
        /// Initializes the control and child controls.
        /// </summary>
        private void Initialize()
        {
            // Access internal children, which forces instantiation of the generator
            UIElementCollection children = base.InternalChildren;

            // We are an items host
            IsItemsHost = true; // TODO: Should do based on parent container or selector?

            // Create the transition element
            transitionElement = new TransitionElement();
        }
예제 #2
0
        private static object CoerceTransition(object element, object value)
        {
            Debug.WriteLineIf(TraceSwitches.Transitions.TraceVerbose, "TransitionElement - CoerceTransition Entry");
            TransitionElement te = (TransitionElement)element;

            if (te.IsTransitioning)
            {
                Debug.WriteLineIf(TraceSwitches.Transitions.TraceVerbose, "TransitionElement - CoerceTransition returning active transition");
                return(te.activeTransition);
            }
            Debug.WriteLineIf(TraceSwitches.Transitions.TraceVerbose, "TransitionElement - CoerceTransition returning normal current transition");
            return(value);
        }
예제 #3
0
        /// <summary>
        /// Handles a change to the Content property.
        /// </summary>
        private static void OnContentChanged(object element, DependencyPropertyChangedEventArgs e)
        {
            Debug.WriteLineIf(TraceSwitches.Transitions.TraceVerbose, "TransitionElement - OnContentChanged Entry");
            TransitionElement te = element as TransitionElement;

            if (te != null)
            {
                ContentPresenter contentPresenter = te.Content as ContentPresenter;
                FrameworkElement parentFE         = te.Parent as FrameworkElement;
                Debug.WriteLineIf(TraceSwitches.Transitions.TraceVerbose, "TransitionElement - OnContentChanged Beginning Transition");
                te.BeginTransition();
            }
        }
예제 #4
0
        // Don't update direct content until done transitioning
        private static object CoerceContent(object element, object value)
        {
            Debug.WriteLineIf(TraceSwitches.Transitions.TraceVerbose, "TransitionElement - CoerceContent Entry");
            TransitionElement te = element as TransitionElement;

            if (te != null && te.IsTransitioning)
            {
                Debug.WriteLineIf(TraceSwitches.Transitions.TraceVerbose, "TransitionElement - CoerceContent returning te.CurrentContentPresenter.Content");
                return(te.NewContentPresenter.Content);
            }
            Debug.WriteLineIf(TraceSwitches.Transitions.TraceVerbose, "TransitionElement - CoerceContent returning normal value");
            return(value);
        }
예제 #5
0
        // Force clip to be true if the active Transition requires it
        private static object CoerceClipToBounds(object element, object value)
        {
            TransitionElement te = (TransitionElement)element;
            bool clip            = (bool)value;

            if (!clip && te.IsTransitioning)
            {
                Transition transition = te.Transition;
                if (transition.ClipToBounds)
                {
                    return(true);
                }
            }
            return(value);
        }
예제 #6
0
        private static void OnContentTemplateSelectorChanged(object element, DependencyPropertyChangedEventArgs e)
        {
            TransitionElement te = (TransitionElement)element;

            te.NewContentPresenter.ContentTemplateSelector = (DataTemplateSelector)e.NewValue;
        }