问题
Is there a way to set a border radius on an Entry in Xamarin's XAML, or by using a custom renderer or something ?
Everything I've tried up to now has no effect, but for my application it would be really better if I had round borders.
Thank you in advance for your answer !
PS : I've checked this post but I've not found my answer there :)
回答1:
I think you can use a grid with 1 row and 1 column Inside the grid you can add your Entry and, for example, this control, in the same (the only) cell. You should have an Entry with rounded corners...
This is another useful control (XFShape). Create shapes content views from shared code for your mobile apps! For Android and iOS.
回答2:
I've posted this answer here too, but for convenience I'll just paste it below:
I'm not sure if there's something wrong with this approach or not, because it seems so simple but no one's suggesting it.
But I don't see why you can't just use a Frame
with IsClippedToBounds
set to true
. That gives you a built-in corner radius, which you can then adjust as needed.
<Grid>
<Frame
CornerRadius ="20"
IsClippedToBounds="true">
<Editor />
</Frame>
</Grid>
I'm currently using this solution and it works for me.
来源:https://stackoverflow.com/questions/42598150/border-radius-on-entry-xamarin-forms-pcl