private CalendarSelectableCellnfoAutomationPeer GetOrCreatePeerFromDateTime(DateTime date)
        {
            CalendarSelectableCellnfoAutomationPeer peer = this.childrenCache.OfType <CalendarSelectableCellnfoAutomationPeer>().Where(x => x.CellModel.Date == date).FirstOrDefault();

            if (peer == null && this.CalendarOwner.Model.CalendarCells != null)
            {
                CalendarCellModel model = this.CalendarOwner.Model.CalendarCells.Where(cell => cell.Date == date).FirstOrDefault();
                if (model != null)
                {
                    CalendarViewHostAutomationPeer hostPeer = (CalendarViewHostAutomationPeer)FrameworkElementAutomationPeer.FromElement(this.CalendarOwner.calendarViewHost);
                    peer = new CalendarSelectableCellnfoAutomationPeer(hostPeer, model);
                    this.childrenCache.Add(peer);
                }
            }
            return(peer);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CalendarCellInfoBaseAutomationPeer"/> class.
 /// </summary>
 /// <param name="parentPeer">Parent CalendarViewHostAutomationPeer.</param>
 /// <param name="cellModel">The model of the calendar cell.</param>
 internal CalendarCellInfoBaseAutomationPeer(CalendarViewHostAutomationPeer parentPeer, CalendarNode cellModel) : base()
 {
     this.CalendarViewHostPeer = parentPeer;
     this.CellNode             = cellModel;
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CalendarInvokableCellInfoAutomationPeer"/> class.
 /// </summary>
 /// <param name="parent">Parent CalendarViewHostAutomationPeer.</param>
 /// <param name="cellModel">The model of the calendar cell.</param>
 internal CalendarInvokableCellInfoAutomationPeer(CalendarViewHostAutomationPeer parent, CalendarCellModel cellModel) : base(parent, cellModel)
 {
     this.CalendarCellModel = cellModel;
 }
 /// <summary>
 /// <summary>
 /// Initializes a new instance of the <see cref="CalendarHeaderCellInfoAutomationPeer"/> class.
 /// </summary>
 /// <param name="parent">Parent CalendarViewHostAutomationPeer.</param>
 /// <param name="headerCellModel">The model of the calendar header cell.</param>
 internal CalendarHeaderCellInfoAutomationPeer(CalendarViewHostAutomationPeer parent, CalendarHeaderCellModel headerCellModel) : base(parent, headerCellModel)
 {
     this.HeaderCellModel = headerCellModel;
 }