如何将Style中的属性绑定到后面的模板化父代码?

时间:2012-02-26 09:34:41

标签: c# wpf xaml

如何绑定Width& EllipseStyle内的ResizeThumb高度为ResizeThumb背后的代码?

<Style x:Key="ResizeThumbStyle" TargetType="{x:Type me:ResizeThumb}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type me:ResizeThumb}"> <Grid> <Ellipse Height="???" Width="???"></Ellipse> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> 风格:

ResizeThumb

<ControlTemplate x:Key="ResizeDecoratorTemplate" > <Grid> <me:ResizeThumb Name="TL" Width="{Binding Path=ResizerWidth}" Height="{Binding Path=ResizerHeight}" Style="{StaticResource ResizeThumbStyle}" /> </Grid> </ControlTemplate> ControlTemplate:

ResizeThumb

public readonly int ResizerWidth = 75; public readonly int ResizerHeight = 75; 代码背后:(绑定目的地)

{{1}}

0 个答案:

没有答案