1
我爲各種形狀的UserControl設計了一種風格,例如Star,Ball,Sky等。所有這些形狀都是使用路徑設計的。我需要使用樣式讀取usercontrol的內容,並調整寬度和高度並顯示內容。設計UserControl風格,內容介於
<Style TargetType="{x:Type UserControl}">
<Setter Property="Background" Value="#CCC4C4" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type UserControl}">
<Path
Data="F1M37.3,41.5L24.0,34.8 10.7,41.4 13.2,27.3 2.5,17.3 17.4,15.3 24.0,2.5 30.6,15.3 45.5,17.4 34.7,27.3 37.3,41.5z"
Fill="White"
Height="{TemplateBinding Height}"
Width="{TemplateBinding Width}"
Stroke="#FFC4A000"
StrokeMiterLimit="4"
StrokeThickness="1">
</Path>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>