I am trying to bind current DateTime to a textblock object in WinUI3.
<Page
x:Class="HabitTracker.Screens.HomePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:HabitTracker.Screens"
xmlns:sys="using:System"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<Grid>
<GridView MaxHeight="500" ItemsSource="{x:Bind Habits}">
<GridView.HeaderTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Spacing="45">
<TextBlock Text="{x:Bind sys:DateTime.Now}" />
<TextBlock Text="hello2" />
<TextBlock Text="hello2" />
<TextBlock Text="hello2" />
<TextBlock Text="hello2" />
</StackPanel>
</DataTemplate>
</GridView.HeaderTemplate>
... But my binding doesn't work. I get empty string on the UI while running the application.
I have the following namespace declaration:
xmlns:sys="using:System"
What am I missing?