From be6b23c47b2b20493ff6120a95ac8d45b8886692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Kaan=20K=C3=B6se?= Date: Tue, 6 Jan 2026 11:45:03 +0100 Subject: [PATCH] AOT safe panels. --- .../Styles/WinoCalendarResources.xaml | 23 ++++------- .../Styles/WinoCalendarResources.xaml.cs | 40 ++++++++++++++++++- 2 files changed, 47 insertions(+), 16 deletions(-) diff --git a/Wino.Mail.WinUI/Styles/WinoCalendarResources.xaml b/Wino.Mail.WinUI/Styles/WinoCalendarResources.xaml index b9a6f657..9a545f5e 100644 --- a/Wino.Mail.WinUI/Styles/WinoCalendarResources.xaml +++ b/Wino.Mail.WinUI/Styles/WinoCalendarResources.xaml @@ -27,7 +27,7 @@ - + @@ -41,8 +41,7 @@ - - + @@ -61,7 +60,7 @@ - + @@ -69,11 +68,7 @@ - - + @@ -103,18 +98,16 @@ + ItemsSource="{x:Bind CalendarDays}" + Loaded="OnEventGridsItemsControlLoaded"> - - + diff --git a/Wino.Mail.WinUI/Styles/WinoCalendarResources.xaml.cs b/Wino.Mail.WinUI/Styles/WinoCalendarResources.xaml.cs index 9fbc60f5..e066da1c 100644 --- a/Wino.Mail.WinUI/Styles/WinoCalendarResources.xaml.cs +++ b/Wino.Mail.WinUI/Styles/WinoCalendarResources.xaml.cs @@ -1,4 +1,8 @@ -using Microsoft.UI.Xaml; +using CommunityToolkit.WinUI.Controls; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Wino.Calendar.Controls; +using Wino.Core.Domain.Models.Calendar; namespace Wino.Styles; @@ -8,4 +12,38 @@ public sealed partial class WinoCalendarResources : ResourceDictionary { this.InitializeComponent(); } + + private void OnRegularEventItemsControlLoaded(object sender, RoutedEventArgs e) + { + if (sender is ItemsControl itemsControl && itemsControl.DataContext is CalendarDayModel dayModel) + { + if (itemsControl.ItemsPanelRoot is WinoCalendarPanel panel) + { + panel.HourHeight = dayModel.CalendarRenderOptions.CalendarSettings.HourHeight; + panel.Period = dayModel.Period; + } + } + } + + private void OnDayColumnsItemsControlLoaded(object sender, RoutedEventArgs e) + { + if (sender is ItemsControl itemsControl && itemsControl.DataContext is DayRangeRenderModel rangeModel) + { + if (itemsControl.ItemsPanelRoot is UniformGrid uniformGrid) + { + uniformGrid.Columns = rangeModel.CalendarRenderOptions.TotalDayCount; + } + } + } + + private void OnEventGridsItemsControlLoaded(object sender, RoutedEventArgs e) + { + if (sender is ItemsControl itemsControl && itemsControl.DataContext is DayRangeRenderModel rangeModel) + { + if (itemsControl.ItemsPanelRoot is UniformGrid uniformGrid) + { + uniformGrid.Columns = rangeModel.CalendarRenderOptions.TotalDayCount; + } + } + } }