A user control (written under VS 2008) has the SelectedColor Dependency property, and its control template contains the following:
... <Rectangle> <Rectangle.Fill> <SolidColorBrush Color="{TemplateBinding SelectedColor}"/> </Rectangle.Fill> </Rectangle> ...
A rectangle does not have the correct color if the snap is not related to:
... <Rectangle> <Rectangle.Fill> <SolidColorBrush Color="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}}"/> </Rectangle.Fill> </Rectangle> ...
Well, I know that TemplateBinding is a simplified version of Binding, and it has a set of restrictions, so what is the restriction that makes the above code not work?
source share