我正在使用具有 android 和 ios 專案的 Xamarin.Form,我想在串列視圖中創建添加形狀。

我搜索相同,我們可以使用路徑類,但不知道如何使用它。
請將您的解決方案發送給我
謝謝
uj5u.com熱心網友回復:
您可以使用路徑類。路徑類有一個資料屬性。例如
<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
uj5u.com熱心網友回復:
<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
請查看此鏈接,您有任何問題可以問我嗎?
uj5u.com熱心網友回復:
你可以使用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
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/384142.html
標籤:C# 沙马林 xamarin.forms 移动的 画画
