Why no generics used in the WPF API?

Ive just spent the last few days familiarising myself with the WPF API.

Its seems that almost no generics are used in this API at all.

It would be a shame to release yet another non-generic API now that Whidbey has shipped.



Answer this question

Why no generics used in the WPF API?

  • DaleJ

    I can think of one: Animation<T>.

    Even if it's only a base class, it could do much of the grunt work. Practically all that would be left to implement would be abstract protected methods like:

    protected abstract void T GetValue(AnimationClock clock);

    or something similar..


  • Quantum_x

    Ya know, I can honestly think of only one place in the intrinsic API where a generic is used: PageFunction. A lot of the classes implement generic collection interfaces and such, but other than that I can't think of a generic class introduced in the API.

    That said, out of curiousity, what part of the API do you think would benefit from the use of generics

    Cheers,
    Drew


  • Klarita

    Rob,

    It would be great to see XAML support x:TypeArguments on any element. I could use this today.

    Cheers,

    Rana Ian


  • NilsonGO

    The other place that generics are used is the ObservableCollection<T>.

    Andy


  • Deepakc

    While WPF was being built we had a long period of time where Generics were not possible to use (for perf or other reasons). At the point where Generics became viable some teams had more important work to do than switching things like the Animation class to Animation<T>.

    Animation is one of those areas...they had more important work to be done to make sure our Animation system would solve customer scenarios.

    We would have liked to have had more time for using generics in our animation system.

    The animation system does use Nullable<T> quite a bit.

    Generics work we have done in v1:

    PageFunction<T>
    Xaml support for x:TypeArguments on root element of compiled xaml.

    Generics work we would like to do in the future:
    Xaml support for x:TypeArguments on any element in non-compiled or compiled xaml.

    We'd love to hear other things that you'd like to see.

    Thanks, Rob Relyea
    PM, WPF Team
    http://longhornblogs.com/rrelyea


  • Why no generics used in the WPF API?