我的代碼中有幾次這個代碼
<Image
Aspect="AspectFit"
HeightRequest="75"
WidthRequest="75">
<Image.Clip>
<EllipseGeometry
Center="37.5,37.5"
RadiusX="37.5"
RadiusY="37.5" />
</Image.Clip>
</Image>
我想將其提取為 XAML 樣式以重用和減少代碼
它看起來像這樣
<Style TargetType="Image" ApplyToDerivedTypes="True" x:Key="roundedImageStyle">
<Setter Property="HeightRequest" Value="75"/>
<Setter Property="WidthRequest" Value="75"/>
<Setter Property="Aspect" Value="AspectFit"/>
<Setter Property="Clip" Value="??????"/>
</Style>
如何設定Clip內部樣式?
uj5u.com熱心網友回復:
@jfversluis 告訴我可以這樣實作
<Setter Property="Clip">
<EllipseGeometry
Center="37.5,37.5"
RadiusX="37.5"
RadiusY="37.5" />
</Setter>
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/353508.html
標籤:xml 沙马林 xamarin.forms
