diff --git a/src/Avalonia.Controls/Calendar/CalendarItem.cs b/src/Avalonia.Controls/Calendar/CalendarItem.cs index 9806140275..719229afea 100644 --- a/src/Avalonia.Controls/Calendar/CalendarItem.cs +++ b/src/Avalonia.Controls/Calendar/CalendarItem.cs @@ -215,6 +215,7 @@ namespace Avalonia.Controls.Primitives // Week-number cells — added after existing cells to preserve child indices 0–48. // Header placeholder (row 0, col 0) _weekNumberHeaderLabel = new CalendarWeekNumberLabel(); + _weekNumberHeaderLabel.IsHeader = true; _weekNumberHeaderLabel.SetValue(Grid.RowProperty, 0); _weekNumberHeaderLabel.SetValue(Grid.ColumnProperty, 0); children.Add(_weekNumberHeaderLabel); diff --git a/src/Avalonia.Controls/Calendar/CalendarWeekNumberLabel.cs b/src/Avalonia.Controls/Calendar/CalendarWeekNumberLabel.cs index 71b65a8fe2..92b46a9eaa 100644 --- a/src/Avalonia.Controls/Calendar/CalendarWeekNumberLabel.cs +++ b/src/Avalonia.Controls/Calendar/CalendarWeekNumberLabel.cs @@ -4,8 +4,26 @@ namespace Avalonia.Controls.Primitives /// Displays a week number in the month view of a . /// Apply styles targeting to customise /// the appearance — for example FontWeight="Bold". + /// Use the :header pseudo-class to target the column header cell (row 0). /// public sealed class CalendarWeekNumberLabel : ContentControl { + private bool _isHeader; + + /// + /// Gets or sets a value indicating whether this label is the column header cell + /// (placed in row 0 of the month grid, above the week-number data cells). + /// Themes can target this with the :header pseudo-class. + /// + public bool IsHeader + { + get => _isHeader; + internal set + { + if (_isHeader == value) return; + _isHeader = value; + PseudoClasses.Set(":header", value); + } + } } } diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResources.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResources.xaml index 2613a0a133..03fcc462da 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResources.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResources.xaml @@ -402,6 +402,8 @@ + @@ -1228,6 +1230,8 @@ + diff --git a/src/Avalonia.Themes.Fluent/Controls/CalendarWeekNumberLabel.xaml b/src/Avalonia.Themes.Fluent/Controls/CalendarWeekNumberLabel.xaml index be073807e3..c458f355ca 100644 --- a/src/Avalonia.Themes.Fluent/Controls/CalendarWeekNumberLabel.xaml +++ b/src/Avalonia.Themes.Fluent/Controls/CalendarWeekNumberLabel.xaml @@ -5,21 +5,35 @@ - + - + + + + + + diff --git a/src/Avalonia.Themes.Simple/Controls/CalendarWeekNumberLabel.xaml b/src/Avalonia.Themes.Simple/Controls/CalendarWeekNumberLabel.xaml index f5c950bbd2..1066282db2 100644 --- a/src/Avalonia.Themes.Simple/Controls/CalendarWeekNumberLabel.xaml +++ b/src/Avalonia.Themes.Simple/Controls/CalendarWeekNumberLabel.xaml @@ -3,21 +3,35 @@ x:ClassModifier="internal"> - - + + + + - + + + + + +