Thank you, aw3!
It works! Really happy about the solution.
Update requested by Kristof Bergé...
--------------------------------------------
It could perhaps be a bit confusing, but I wrote the question for the "Dashboard" page but I tried out the answer for a page named "MainPage".
XMAL code
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:viewmodel="clr-namespace:SleepDiaryViewModel.ViewModels;assembly=SleepDiaryViewModel"
x:DataType="viewmodel:MainPageViewModel"
x:Class="SleepDiary.MainPage"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit">
<ContentPage.BindingContext>
<viewmodel:MainPageViewModel />
</ContentPage.BindingContext>
<ScrollView>
<VerticalStackLayout>
<Label
HorizontalOptions="Start"
VerticalOptions="Center"
Text="{Binding Test}"
TextColor="Green"
FontSize="Title"/>
</VerticalStackLayout>
</ScrollView>
</ContentPage>
.CS-file (I have left out unneccesary code)
public partial class MainPage : ContentPage
{
protected override void OnAppearing()
{
(BindingContext as MainPageViewModel).ReloadData();
base.OnAppearing();
}
public MainPage()
{
InitializeComponent();
BindingContext = new SleepDiaryViewModel.ViewModels.MainPageViewModel();
}
}