After testing, I tested the BasedOn
property with the following code and this issue did not occur.
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MauiApp6.MainPage">
<ContentPage.Resources>
<Style x:Key="baseLabelStyle" TargetType="Label">
<Setter Property="FontSize" Value="Caption" />
</Style>
<Style x:Key="infoLabelStyle" BasedOn="{StaticResource baseLabelStyle}" TargetType="Label">
<Setter Property="FontAttributes" Value="Bold" />
</Style>
</ContentPage.Resources>
<ScrollView>
<Label Text="test" Style="{StaticResource infoLabelStyle}"/>
</ScrollView>
</ContentPage>
According to MauiMaui API documentation, Style.BasedOn
Property is a basic property. Therefore, this issue is more of a namespace issue. Does your Maui project include the Nuget Package for Microsoft.Maui.Controls
? If you update it to the latest version, will this issue still occur?