In .NET MAUI, there's a nice way to handle styling of controls globally through the Styles.xaml
file under Resources/Styles
folder.
Is there a way to add rounded corners to all Entry
controls through the Styles.xaml
file rather than handle it individually in ContentPage
XAML
files?
Here's the standard styling, out of the box, for Entry
controls in a .NET MAUI app. Is there a way to add rounded corners to this here? I understand we now handle rounded corners through Border
control. Could I define a border in Styles.xaml
and then reference it in styles for Entry
control?
<Style TargetType="Entry">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="BackgroundColor" Value="{StaticResource FormElementBackground}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontSize" Value="14" />
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray300}, Dark={StaticResource Gray600}}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>