我有这段代码:
<Path Fill="Brown">
<Path.Data>
<RectangleGeometry x:Name="rec"
RadiusX="0"
RadiusY="20"
Rect="410,135,60,25"></RectangleGeometry>
</Path.Data>
</Path>
如何为此Image
设置背景Rectangle
?
答案 0 :(得分:1)
您可以使用ImageBrush
作为路径的Fill
属性:
<Path>
<Path.Fill>
<ImageBrush ImageSource="..."/>
</Path.Fill>
<Path.Data>
<RectangleGeometry x:Name="rec" RadiusX="0" RadiusY="20" Rect="410,135,60,25"></RectangleGeometry>
</Path.Data>
</Path>