private FindDayButtonFromDay ( DateTime day ) : |
||
day | DateTime | Inherited code: Requires comment 1. |
return |
internal CalendarDayButton FindDayButtonFromDay(DateTime day)
{
CalendarDayButton b;
DateTime? d;
CalendarItem monthControl = MonthControl;
// REMOVE_RTM: should be updated if we support MultiCalendar
int count = RowsPerMonth * ColumnsPerMonth;
if (monthControl != null)
{
if (monthControl.MonthView != null)
{
for (int childIndex = ColumnsPerMonth; childIndex < count; childIndex++)
{
b = monthControl.MonthView.Children[childIndex] as CalendarDayButton;
d = b.DataContext as DateTime?;
if (d.HasValue)
{
if (DateTimeHelper.CompareDays(d.Value, day) == 0)
{
return b;
}
}
}
}
}
return null;
}
/// <summary> /// Raise an automation peer event for the selection of a day button. /// </summary> /// <param name="calendar"> /// The Calendar associated with this automation peer. /// </param> /// <param name="date">The selected date.</param> /// <param name="eventToRaise">The selection event to raise.</param> private static void RaiseDayButtonSelectionEvent(Calendar calendar, DateTime date, AutomationEvents eventToRaise) { CalendarDayButton button = calendar.FindDayButtonFromDay(date); if (button != null) { AutomationPeer peer = FrameworkElementAutomationPeer.FromElement(button); if (peer != null) { peer.RaiseAutomationEvent(eventToRaise); } } }