using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Metadata; using Avalonia.Controls.Primitives; namespace Ursa.Controls; /// /// Show days in a month. /// [TemplatePart(PART_Grid, typeof(Grid))] public class CalendarMonthView: TemplatedControl { public const string PART_Grid = "PART_Grid"; private Grid? _grid; protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); _grid = e.NameScope.Find(PART_Grid); // GenerateGridElements(); } private int _month; public int Month { get => _month; set { _month = value; // Update(); } } public static readonly StyledProperty FirstDayOfWeekProperty = AvaloniaProperty.Register( nameof(FirstDayOfWeek)); public DayOfWeek FirstDayOfWeek { get => GetValue(FirstDayOfWeekProperty); set => SetValue(FirstDayOfWeekProperty, value); } private void GenerateGridElements() { // Generate Day titles (Sun, Mon, Tue, Wed, Thu, Fri, Sat) based on FirstDayOfWeek and culture. } }