如何为Frame设置不同的圆角半径?

And*_*ici 1 c# xamarin xamarin.forms

设置框架的每个角半径很热吗?它可以全部设置,但我要单独设置它们中的每一个,2舍入2正常。

Dav*_*sus 7

没有黑客,有一个非常简单的解决方案:

使用 nuget 包Xamarin.Forms.PancakeView

在此处输入图片说明

如何使用它?

  1. 安装 nuget 包 Xamarin.Forms.PancakeView。
  2. 然后你需要做的是告诉我们的 XAML 页面它可以在哪里找到 PancakeView,这是通过向我们的 ContentPage 添加以下属性来完成的:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
     xmlns:yummy="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView">
       ...
</ContentPage>
Run Code Online (Sandbox Code Playgroud)
  1. 只需在该页面上添加一个 PancakeView 就可以了:
<yummy:PancakeView BackgroundColor="#bc91d7" CornerRadius="60,0,0,60" IsClippedToBounds="true" HorizontalOptions="FillAndExpand" HeightRequest="150">
   <Image Source="unicorn.png" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Aspect="AspectFill" />
</yummy:PancakeView>
Run Code Online (Sandbox Code Playgroud)