I am looking at needle customization documentation topic: "Customizing appearance of the radial gauge " and the following template:
produces templatebinding (attached) picture. Note the red rectangle that should be ActualHeight x ActualHeight big, yet it is much wider (1/2 of the grid).
However, the "should be equivalent" binding
produces the correct result (see expandedbinding picture).
Correct style:
<Style x:Key="TriangleNeedleTemplate" TargetType="{x:Type telerik:Needle}"> |
<Setter Property="Template"> |
<Setter.Value> |
<ControlTemplate TargetType="{x:Type telerik:Needle}"> |
<Grid Width="{TemplateBinding ActualWidth}" Height="{TemplateBinding ActualHeight}"> |
<Grid.ColumnDefinitions> |
<ColumnDefinition Width="{TemplateBinding ActualHeight}"/> |
<ColumnDefinition Width="*" /> |
</Grid.ColumnDefinitions> |
<Grid.RowDefinitions> |
<RowDefinition Height="{TemplateBinding ActualHeight}" /> |
</Grid.RowDefinitions> |
<Border Background="Red" /> |
<Polygon Grid.ColumnSpan="2" Points="0,0 1,0.5 0,1 0,0" Stretch="Fill" |
Fill="White" /> |
</Grid> |
</ControlTemplate> |
</Setter.Value> |
</Setter> |
</Style> |
produces templatebinding (attached) picture. Note the red rectangle that should be ActualHeight x ActualHeight big, yet it is much wider (1/2 of the grid).
However, the "should be equivalent" binding
{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ActualHeight} |
Correct style:
<Style x:Key="TriangleNeedleTemplate" TargetType="{x:Type telerik:Needle}"> |
<Setter Property="Template"> |
<Setter.Value> |
<ControlTemplate TargetType="{x:Type telerik:Needle}"> |
<Grid Width="{TemplateBinding ActualWidth}" Height="{TemplateBinding ActualHeight}"> |
<Grid.ColumnDefinitions> |
<ColumnDefinition Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ActualHeight}"/> |
<ColumnDefinition Width="*" /> |
</Grid.ColumnDefinitions> |
<Grid.RowDefinitions> |
<RowDefinition Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ActualHeight}" /> |
</Grid.RowDefinitions> |
<Border Background="Red" /> |
<Polygon Grid.ColumnSpan="2" Points="0,0 1,0.5 0,1 0,0" Stretch="Fill" |
Fill="White" /> |
</Grid> |
</ControlTemplate> |
</Setter.Value> |
</Setter> |
</Style> |