Attached Dependency Property vs. Dictionary - Silverlight

first post. So, firstly, thanks for all the help over the years, as I learned from the sidelines. I have a rather specific code design that I could not find elsewhere.

I have a series of storyboards (among other things) that relate to certain FrameworkElements that need to be generated in the code, and I feel it is either a little dirty, and maybe a little slower (I thought, t) to store the dictionary with relations FrameworkElement - Storyboard to search on the fly.

    private static Dictionary<FrameworkElement, Storyboard> storyboardMapping;

    private void FrameworkElement_SizeChanged(object sender, SizeChangedEventArgs e)
    {
        FrameworkElement fe = sender as FrameworkElement;
        Storyboard sb = null;

        if(storyboardMapping.TryGetValue(fe, out sb))
        {
            sb.Begin();
        }
        // etc
    }

(private) Attached Dependency Properties, - , ? , , , WeakReferences. # Guru, , Garbage Collection.

, , . , 400 ?

+3
2

, , .Resources UIElements, .

, , , . , ...

0

. .

, () ( ), .

0

All Articles