我想做这样的事情是一种风格:
Value="{x:Bind MyCustomDependencyProp, RelativeSource={RelativeSource TemplatedParent}}"
这可能吗?有任何性能优势吗?
使用 TemplateBinding 似乎不起作用,使用自定义 DependencyProperty,如此处其他地方所述:https://stackoverflow.com/a/8657453
最佳答案
不支持 RelativeSource(使用 x:Bind),因此这种特殊情况是不可能的(至少目前是这样)。
使用 TemplateBinding 或标准绑定(bind)到 TemplatedParent(如您所述)是解决方法。
TemplateBinding 已经是 an optimized version结合,所以根据这个 Build 2015 session by Sam Spencer. 应该没什么大不了的
关于dependency-properties - 是否可以使用已编译的绑定(bind) (x :Bind) with Relative Source, Templated Parent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32372073/