【发布时间】:2022-01-19 06:25:37
【问题描述】:
【问题讨论】:
标签: c# xamarin xamarin.forms mobile drawing
【问题讨论】:
标签: c# xamarin xamarin.forms mobile drawing
有路径类你可以使用它。 路径类有一个数据属性。例如
<Path Data="M 10,100 L 100,100 100,50Z"
Stroke="Black"
Aspect="Uniform"
HorizontalOptions="Start" />
数据字符串以移动命令开头,用 M 表示,它为路径建立了一个绝对起点。 L 是 line 命令,它创建从起点到指定终点的直线。 Z 是关闭命令,它创建一条连接当前点和起点的线。
请查看下面给出的链接,路径已添加到列表视图中: https://xamarinuidesigns.blogspot.com/2021/12/listview-ui-design-2.html
【讨论】:
您可以使用Composite geometries。
<Path StrokeThickness="2" Fill="Orange">
<Path.Data>
<GeometryGroup FillRule="Nonzero">
<RectangleGeometry Rect="0,0,50,50" />
<EllipseGeometry RadiusX="25"
RadiusY="25"
Center="50,25" />
</GeometryGroup>
</Path.Data>
</Path>
在列表视图中的使用:
<ListView ItemsSource="{Binding list}" RowHeight="60">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Horizontal">
<Path StrokeThickness="2" Fill="Orange">
<Path.Data>
<GeometryGroup FillRule="Nonzero">
<RectangleGeometry Rect="0,0,50,50" />
<EllipseGeometry RadiusX="25"
RadiusY="25"
Center="50,25" />
</GeometryGroup>
</Path.Data>
</Path>
<Label Text="{Binding Name}"></Label>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
有关复合几何的更多详细信息,请查看以下链接。 https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/shapes/geometries#composite-geometries
【讨论】:
<Path Data="M 10,100 L 100,100 100,50Z"
Stroke="Black"
Aspect="Uniform"
HorizontalOptions="Start" />
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/shapes/path
请查看此链接,如果您有任何问题可以问我?
【讨论】: