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

Jul 6, 2012 at 11: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.

Jul 19, 2012 at 2: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.