Is it possible to use compiled binding (x: Bind) with Relative Source, Templated Parent

I would like to do something like style:

Value="{x:Bind MyCustomDependencyProp, RelativeSource={RelativeSource TemplatedParent}}" 

Is it possible? Are there any performance benefits?

Using TemplateBinding does not work, with a custom DependencyProperty, as described elsewhere here on SO: https://stackoverflow.com/a/2168/

+2
source share
1 answer

RelativeSource (with x: Bind) is not supported, so this particular scenario will not be possible (at the moment, at least).

Using TemplateBinding or standard TemplatedParent bindings (as you mentioned) are workarounds.

TemplateBinding is already an optimized version of the binding, so it should not be so large in accordance with this Collect 2015 session by Sam Spencer.

+2
source

Source: https://habr.com/ru/post/1237203/


All Articles