none
RelativeSource binding doesn't work.

    Question

  • I'm not sure why RelativeSource binding is not working, but the TemplateBinding is working.
    I'm just using the Namer dependency property as a test. It is of type string.
    Reading the docs, the RelativeSource TemplatedParent is basically the same as TemplateBinding, so it SHOULD work.

    <Style
            TargetType="local:Calendar">
            <Setter
                Property="Template">
                <Setter.Value>
                    <ControlTemplate
                        TargetType="local:Calendar">
                        ...
                            <Grid>
                                ...
                                    <TextBlock
                                        Grid.Column="1"
                                        Text="{Binding Path=Namer,RelativeSource={RelativeSource TemplatedParent},
                                        Mode=TwoWay}" />
                                    <TextBlock
                                        Grid.Column="2"
                                        Text="{TemplateBinding Namer}" />
        ...
        </Style>

    Monday, March 12, 2012 3:54 PM

All replies