Xamarin.forms 如何创建带有框架和stackLayout的左边框较厚的xamarin容器
我正在尝试创建一个xamarin表单UI,如下面的快照所示 我正在尝试以下代码Xamarin.forms 如何创建带有框架和stackLayout的左边框较厚的xamarin容器,xamarin.forms,Xamarin.forms,我正在尝试创建一个xamarin表单UI,如下面的快照所示 我正在尝试以下代码 var reviewLabel = new Label { TextColor = Constants.MMSGAlertColor, Text = "Select the benefit to findout more", FontSize = 12 };
var reviewLabel = new Label
{
TextColor = Constants.MMSGAlertColor,
Text = "Select the benefit to findout more",
FontSize = 12
};
var alertLayout = new StackLayout
{
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
BackgroundColor = Constants.MMSGAlertBackgroundColor,
};
var alertContentLayout = new StackLayout
{
Margin = new Thickness(8, 0, 0, 0),
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
BackgroundColor = Constants.MMSGAlertBackgroundColor
};
var warningBoxView = new BoxView
{
BackgroundColor = Constants.MMSGAlertColor
};
alertLayout.Children.Add(warningBoxView);
alertLayout.Children.Add(alertContentLayout);
alertContentLayout.Children.Add(reviewLabel);
var frame = new Frame
{
Padding = 16,
OutlineColor = Constants.MMSGAlertBorderColor,
BackgroundColor = Constants.MMSGAlertBackgroundColor,
HasShadow = false,
Content = alertLayout,
HorizontalOptions = LayoutOptions.Fill,
VerticalOptions = LayoutOptions.FillAndExpand
};
frame.SetBinding(IsVisibleProperty, "IsPaymentPlanEnding");
var rowLayout = new StackLayout
{
};
rowLayout.Children.Add(frame);
rowLayout.Children.Add(rowGrid);
但是当前的用户界面如下所示
结果输出是在帧内出现一个带有填充的厚边框
但我试图生成一个在容器左侧有8px厚条的用户界面
是否有一种方法可以创建一个边框,左边框的厚度为8px,其余边框的厚度为1px。请参见下面的XAML代码。添加所需的正确颜色,因为我使用了自己的颜色。如果需要,也可以在代码隐藏中重写相同的代码
<Frame HasShadow="False" BackgroundColor="Pink" Padding="1" CornerRadius="3" VerticalOptions="CenterAndExpand" >
<Grid BackgroundColor="White" Padding="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<BoxView BackgroundColor="Red" Grid.Column="0"/>
<StackLayout Padding="15,20,0,20" Grid.Column="1" Spacing="20">
<Label Text="Please review" TextColor="Red" FontSize="13" FontAttributes="Bold"/>
<Label Text="Select the benefit above to find more" TextColor="Red" FontSize="13"/>
</StackLayout>
</Grid>
</Frame>
请参阅下面的XAML代码。添加所需的正确颜色,因为我使用了自己的颜色。如果需要,也可以在代码隐藏中重写相同的代码
<Frame HasShadow="False" BackgroundColor="Pink" Padding="1" CornerRadius="3" VerticalOptions="CenterAndExpand" >
<Grid BackgroundColor="White" Padding="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<BoxView BackgroundColor="Red" Grid.Column="0"/>
<StackLayout Padding="15,20,0,20" Grid.Column="1" Spacing="20">
<Label Text="Please review" TextColor="Red" FontSize="13" FontAttributes="Bold"/>
<Label Text="Select the benefit above to find more" TextColor="Red" FontSize="13"/>
</StackLayout>
</Grid>
</Frame>
如果我能用XAML为您提供代码,可以吗?如果我能用XAML为您提供代码,可以吗?