Why is the following working only for the Rectangle, not the TextBox ?
<Window.Resources>
<ControlTemplate x:Key="MyProgressBarTemplate" TargetType="ProgressBar">
<StackPanel Orientation="Vertical">
<Rectangle
Width="{TemplateBinding Property=Value}"
Stroke="Red"
StrokeThickness="3"
Height="25"/>
<TextBox
Text="{TemplateBinding Property=Value}" />
</StackPanel>
</ControlTemplate>
</Window.Resources>
If I change the TextBox attributes to:
DataContext="{TemplateBinding Property=Value}" Text="{Binding Mode=OneWay}"
then it is working ok, I just wonder why I must set the DataContext for the TextBox and not for the Rectangle ?