Does "RelativeSource to x:Static" really save memory ?

Jul 6, 2012 at 10:44 AM

Looking at implementation of RelativeSource.ProvideValue() it looks like it returns cached static instances, so contrary to MSDN documentations using x:Static gains you nothing.

Coordinator
Jul 19, 2012 at 1:27 PM

There is still a RelativeSource that is instantiated, on which ProvideValue() will be called, only to return a shared object. So you'll still shave an extra allocated object and a call. Really tiny optimization, yes, but doesn't cost anything to make.