试试这个:
StrokeDashCap="Square" StrokeThickness="0" SnapsToDevicePixels="True">
5
Name="Border"
Padding="2"
BorderThickness="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness}"
BorderBrush="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderBrush}">
所以我在控件模板中放置了一个矩形框.矩形的边框可以是虚线,或者是虚线或者是w / e(为了使虚线变小,只需将零件更改为2,1不明显).因此,矩形边框粗细的默认值为0,但选中后,我将厚度设置为1,使其可见.我将一些边框属性绑定到其模板化的父级,因此它看起来就像你在你的风格上设置的那样(刷银,厚度0,0,0,1).