|
|
@ -4,6 +4,7 @@ |
|
|
// All other rights reserved.
|
|
|
// All other rights reserved.
|
|
|
|
|
|
|
|
|
using System; |
|
|
using System; |
|
|
|
|
|
using System.Collections.Generic; |
|
|
using System.Diagnostics; |
|
|
using System.Diagnostics; |
|
|
using System.Globalization; |
|
|
using System.Globalization; |
|
|
using Avalonia.Data; |
|
|
using Avalonia.Data; |
|
|
@ -193,6 +194,9 @@ namespace Avalonia.Controls.Primitives |
|
|
{ |
|
|
{ |
|
|
if (MonthView != null) |
|
|
if (MonthView != null) |
|
|
{ |
|
|
{ |
|
|
|
|
|
var childCount = Calendar.RowsPerMonth + Calendar.RowsPerMonth * Calendar.ColumnsPerMonth; |
|
|
|
|
|
var children = new List<IControl>(childCount); |
|
|
|
|
|
|
|
|
for (int i = 0; i < Calendar.RowsPerMonth; i++) |
|
|
for (int i = 0; i < Calendar.RowsPerMonth; i++) |
|
|
{ |
|
|
{ |
|
|
if (_dayTitleTemplate != null) |
|
|
if (_dayTitleTemplate != null) |
|
|
@ -201,7 +205,7 @@ namespace Avalonia.Controls.Primitives |
|
|
cell.DataContext = string.Empty; |
|
|
cell.DataContext = string.Empty; |
|
|
cell.SetValue(Grid.RowProperty, 0); |
|
|
cell.SetValue(Grid.RowProperty, 0); |
|
|
cell.SetValue(Grid.ColumnProperty, i); |
|
|
cell.SetValue(Grid.ColumnProperty, i); |
|
|
MonthView.Children.Add(cell); |
|
|
children.Add(cell); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -222,13 +226,18 @@ namespace Avalonia.Controls.Primitives |
|
|
cell.PointerEnter += Cell_MouseEnter; |
|
|
cell.PointerEnter += Cell_MouseEnter; |
|
|
cell.PointerLeave += Cell_MouseLeave; |
|
|
cell.PointerLeave += Cell_MouseLeave; |
|
|
cell.Click += Cell_Click; |
|
|
cell.Click += Cell_Click; |
|
|
MonthView.Children.Add(cell); |
|
|
children.Add(cell); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
MonthView.Children.AddRange(children); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (YearView != null) |
|
|
if (YearView != null) |
|
|
{ |
|
|
{ |
|
|
|
|
|
var childCount = Calendar.RowsPerYear * Calendar.ColumnsPerYear; |
|
|
|
|
|
var children = new List<IControl>(childCount); |
|
|
|
|
|
|
|
|
CalendarButton month; |
|
|
CalendarButton month; |
|
|
for (int i = 0; i < Calendar.RowsPerYear; i++) |
|
|
for (int i = 0; i < Calendar.RowsPerYear; i++) |
|
|
{ |
|
|
{ |
|
|
@ -246,9 +255,11 @@ namespace Avalonia.Controls.Primitives |
|
|
month.CalendarLeftMouseButtonUp += Month_CalendarButtonMouseUp; |
|
|
month.CalendarLeftMouseButtonUp += Month_CalendarButtonMouseUp; |
|
|
month.PointerEnter += Month_MouseEnter; |
|
|
month.PointerEnter += Month_MouseEnter; |
|
|
month.PointerLeave += Month_MouseLeave; |
|
|
month.PointerLeave += Month_MouseLeave; |
|
|
YearView.Children.Add(month); |
|
|
children.Add(month); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
YearView.Children.AddRange(children); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|