TemplateBinding到同一个Property

时间:2013-03-11 18:02:51

标签: wpf templatebinding

有人会解释这个TemplateBinding绑定到什么?

// excerpt of a Style that applies to an ItemsControl
<Setter Property="ItemsPanel">
  <Setter.Value>
    <ItemsPanelTemplate>
      <local:PiePanel Values="{TemplateBinding local:PiePanel.Values}"/>
    </ItemsPanelTemplate>
  </Setter.Value>
</Setter>

PiePanel定义了DependencyProperty

    public static readonly DependencyProperty ValuesProperty =
        DependencyProperty.RegisterAttached("Values", typeof(ObservableCollection<double>), typeof(PiePanel), ...

AFAIK,TemplateBinding转换为

<local:PiePanel Values={Binding RelativeSource={RelativeSource TemplatedParent}, Path=local:PiePanel.Values}" />

那么值绑定到Child的Values属性,该属性在Child中定义?我的解释是否正确?未为Parent定义Values属性(在本例中为Style的TargetType)。

0 个答案:

没有答案