Styling an attached property with inheritance
My question is similar to this: WPF Style with no target type? but the problem is that mine is an att开发者_StackOverflow社区ached property:
<Style TargetType="Shape" >
<Setter Property="z:Zommable.Unscale" Value="StrokeThickness" />
</Style>
My goal is: all object deriving from shape must have the attached property Zommable.Unscale with a value, but I can't find how to do it. Thanks !
there is no difference to the other question. you will have to do exactly the same. So for each class deriving from Shape you will have to use a Style with that targettype that's BasedOn your style with your attached property.
So it's gonna be:
<Style x:Key="basicStyle">
<Setter Property="z:Zommable.Unscale" Value="StrokeThickness" />
</Style>
<Style TargetType="{x:Type Ellipse}" BasedOn="{StaticResource basicStyle}">
<!-- ... -->
</Style>
<Style TargetType="{x:Type Rectangle}" BasedOn="{StaticResource basicStyle}">
<!-- ... -->
</Style>
<!-- ... -->
精彩评论