问题描述
在我的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.5
和Padding
的BackgroundColor
和Padding
包裹StackLayout
到视图(如您提到的StackLayout
或Grid
),如此处.
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形成带边框的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!