AOT safe panels.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user