【发布时间】:2017-10-31 16:44:13
【问题描述】:
我在 Xamarin Forms Shared 项目上使用 Frame 控件。 我只是有一些样式:
<Color x:Key="Info">#0060ac</Color>
...
<Style x:Key="LabelContainer" TargetType="Frame">
<Setter Property="Padding" Value="5" />
<Setter Property="HorizontalOptions" Value="Fill" />
</Style>
<Style x:Key="LabelContainer-Info" TargetType="Frame" BasedOn="{StaticResource LabelContainer}">
<Setter Property="BackgroundColor" Value="{DynamicResource Info}" />
</Style>
以及 XAML 页面中的一个简单 Frame 控件:
<Frame x:Name="CreditCardPaymentResultFrame" Style="{StaticResource LabelContainer-Info}" Padding="0">
<Label x:Name="PaymentErrorLabel" Text="Lorem ipsum" IsVisible="True"
HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
VerticalTextAlignment="Center" HorizontalTextAlignment="Center"
FontSize="18" TextColor="White">
</Label>
</Frame>
我得到了这样的东西:
现在,如果我尝试在运行时更改背景颜色:
CreditCardPaymentResultFrame.BackgroundColor = Color.FromHex("#ed3700");
框架控件失去了边框圆度:
我不明白这种行为,我需要更改背景颜色,但我想保留圆角。
感谢帮助我的人
【问题讨论】:
-
你使用什么平台?
-
嗨。我用的是安卓
标签: c# xamarin.forms