Abschneiden einer Grenze in WPF
Ich muss eine Runde erstellenProgressBar
Vorlage.
ControlTemplate:
<ControlTemplate TargetType="{x:Type ProgressBar}">
<Grid x:Name="TemplateRoot" SnapsToDevicePixels="true">
<Rectangle x:Name="PART_Track" Margin="1" Fill="White" />
<Border x:Name="PART_Indicator" HorizontalAlignment="Left" Margin="1" >
<Grid x:Name="Foreground" >
<Rectangle x:Name="Indicator" Fill="{TemplateBinding Background}" />
<Grid x:Name="Animation" ClipToBounds="true" >
<Rectangle x:Name="PART_GlowRect" Fill="#FF86C7EB"
HorizontalAlignment="Left" Margin="-100,0,0,0" Width="100"/>
</Grid>
</Grid>
</Border>
<Border x:Name="roundBorder" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="10" />
<TextBlock />
</Grid>
</ControlTemplate>
Das führt zu :
WoPART_Indicator
ist das LightBlue Rechteck auf der linken Seite (seine Breite wird intern in der Leiste eingestellt)ProgressBar
Kontrolle, wie hier mit einem Wert von 20) und dieroundBorder
.
Was ich brauche ist für diePART_Indicator
zum überclipsen derroundBorder
, was zu etwas führt wie: