Hello,
You can do this by moving BindingContext="{x:Reference thisUC}"
to the <Stacklayout>
and no need to set Reference
for Label's binding property again, you can refer to following xaml code.
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Name="thisUC"
x:Class="MauiApp2.CardView">
<StackLayout BindingContext="{x:Reference thisUC}" >
<Label Text="{Binding CardTitle}" FontSize="20" BackgroundColor="Gray" Margin="5"/>
</StackLayout>
</ContentView>
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.