Toolkit DataForm with TransitionControl 2011 Q3

2 posts, 0 answers
  1. Peter Avritch
    Peter Avritch avatar
    7 posts
    Member since:
    Oct 2006

    Posted 22 Dec 2011 Link to this post

    We use a TransitionControl as part of an image picker user control which all lives inside an SL4 toolkit DataForm control in combination with RIA Services. This has all worked fine for the last 18 months or so through all Telerik updates.

    However, starting with 2011 Q3 (and also for Q3 SP1), the DataForm was throwing an exception when clicking save on any of our 15+ dialogs hosting this image picker.

    I tracked the problem down to where the DataForm was enumerating the bindable properties of the RadTransitionControl. Apparently a recent change to this control resulted in a null value being inserted into the List<DependencyProperty>, which ultimately caused a managed runtime error up the chain.

    Since the SL4 Toolkit includes source, I made a simple change to ensure null values do not get added to the List, and now all is good again.

    I am not held up on this since I have simply included my own compiled copy of this DLL into my project; however, I thought you would like to be aware of this conflict so you might address it in your next release.

    My own code base is too big to include as a sample, but I would believe you could reproduce this simply by including a transition control inside a DataForm edit template and clicking save to trigger the DataForm's validation logic.


           /// <summary>
            /// Gets the list of dependency properties for the given element.
            /// </summary>
            /// <param name="element">The element.</param>
            /// <returns>The list of dependency properties.</returns>
            public static List<DependencyProperty> GetDependencyPropertiesForElement(FrameworkElement element)
                List<DependencyProperty> dependencyProperties = new List<DependencyProperty>();

                if (element == null)
                    return dependencyProperties;

                bool isBlocklisted =
                    element is Panel || element is Button || element is Image || element is ScrollViewer || element is TextBlock ||
                    element is Border || element is Shape || element is ContentPresenter || element is RangeBase;

                if (!isBlocklisted)
                    FieldInfo[] fields = element.GetType().GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);

                    if (fields != null)
                        foreach (FieldInfo field in fields)
                            if (field.FieldType == typeof(DependencyProperty))
    #if true // this is the fix
           // make sure the list doen't have any null records
                                var dp = (DependencyProperty)field.GetValue(null);
                                if (dp != null)
    #else // original way
        // the error is that with the 2011 Q3 RadTransitionControl, this
        // causes a null to end up in the list, which then throws a
        // managed runtime error 4004 in the caller.

                return dependencyProperties;


  2. Pana
    Pana avatar
    748 posts

    Posted 27 Dec 2011 Link to this post


    Thank you for the feedback. We have found out that there is one unused dependency property declaration for the bool IsTransitionPlaying which was replaced with its negative IsTransitionIdle. The second is more commonly used as one can bind IsEnabled to IsTransitionIdle in cases where some UI should not be available while the transitions are on. The leftover however seems to break the code you refer as the static field never gets a value and remains null. We will fix that ASAP.

    Kind regards,
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. DevCraft R3 2016 release webinar banner
Back to Top