【发布时间】:2010-12-20 17:04:20
【问题描述】:
看起来 ControlTemplate 中的以下 Ellipse 没有得到 BorderThickness,但为什么呢?
<Window.Resources>
<ControlTemplate x:Key="EllipseControlTemplate" TargetType="{x:Type TextBox}">
<Grid>
<Ellipse
Width="{TemplateBinding ActualWidth}"
Height="{TemplateBinding ActualHeight}"
Stroke="{TemplateBinding Foreground}"
StrokeThickness="{TemplateBinding BorderThickness}" />
<ScrollViewer Margin="0" x:Name="PART_ContentHost" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Window.Resources>
<Grid>
<TextBox
Template="{DynamicResource EllipseControlTemplate}"
Foreground="Green"
BorderThickness="15" />
</Grid>
模板绑定到Foreground 工作得很好,椭圆是绿色的。但是对于StrokeThickness 似乎不起作用,为什么?
【问题讨论】:
标签: .net wpf xaml .net-3.5 templatebinding