Xamarin形成带边框的控件 [英] Xamarin Forms Controls with borders

查看:66
本文介绍了Xamarin形成带边框的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Xamarin表单应用程序中,我想向Grid/StackPanel添加边框.而且背景颜色将是透明的.我使用了帧控件,但是当我将背景色设置为透明时,边框也没有显示.请帮帮我吗?

In my Xamarin forms application I want to add borders to a Grid / StackPanel. Also the background color will be transparent. I used frame control , but when I set background color to transparent the border also not shown. Please help me?

推荐答案

您基本上有两个可能性,因为Forms尚不支持此可能性,其中第一个是使用BoxViews,如

You basically have two possibilies, since this is not yet supported in Forms, where the first is to use BoxViews as explained on SO in this post.

否则,您可以用0.5PaddingBackgroundColorPadding包裹StackLayout到视图(如您提到的StackLayoutGrid),如

Otherwise, you can wrap a StackLayout around your View (the StackLayout or Grid as you mentioned) with a BackgroundColor and Padding of 0.5 as explained here.

让我知道您是否需要更多具体示例.

Let me know if you need more concrete examples.

这篇关于Xamarin形成带边框的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆