現在、開発にWPF .NET 3.5を使用しており、ikrivのMath Converterを使用して、設計で数学的なタスクを実行することにしました。
<ControlTemplate x:Key="RectangleTemplate">
<Grid Background="Transparent">
<Rectangle x:Name="Shape" Stroke="#d69e31" Fill="{StaticResource YellowGradientBrush}">
<!-- Create a rectangle that applies Cornering accoding to it's (in form) indicated height -->
<Rectangle.RadiusX>
<MultiBinding Converter="{StaticResource MathConverter}" ConverterParameter="x/2.5">
<!-- Error occurs in the line below -->
<Binding Path="Object" ElementName="{TemplateBinding Property=Button.Height}" />
</MultiBinding>
</Rectangle.RadiusX>
<Rectangle.RadiusY>
<MultiBinding Converter="{StaticResource MathConverter}" ConverterParameter="x/2.5">
<!-- Error occurs in the line below -->
<TemplateBinding Property="Button.Height" />
</MultiBinding>
</Rectangle.RadiusY>
</Rectangle>
</Grid>
</ControlTemplate>
+例外アシストによると:
InnerException:System.InvalidCastException
メッセージ=タイプ'System.Windows.TemplateBindingExpression'のオブジェクトをタイプ'System.String'にキャストできません。
ありがとう。