/// <inheritdoc />
        protected override IList <AutomationPeer> GetChildrenCore()
        {
            List <AutomationPeer>     children     = new List <AutomationPeer>();
            RadCalendarAutomationPeer calendarPeer = FrameworkElementAutomationPeer.FromElement(this.CalendarOwner) as RadCalendarAutomationPeer;

            IList <AutomationPeer> textBlockPeers = this.GetTextBlockPeers();

            foreach (CalendarCellModel cellModel in this.CalendarOwner.Model.currentViewModel.CalendarCells)
            {
                CalendarCellInfoBaseAutomationPeer peer = calendarPeer.childrenCache
                                                          .OfType <CalendarCellInfoBaseAutomationPeer>().FirstOrDefault(a => this.AreModelsEqual(a.CellNode, cellModel));

                if (peer == null)
                {
                    peer = this.GetPeerByCurrentView(cellModel);
                    calendarPeer.childrenCache.Add(peer);
                }

#if NETFX_CORE
                // UNO TODO
                TextBlock matchingTextBlock = this.CalendarOwner.contentLayer.realizedCalendarCellDefaultPresenters[cellModel];
                if (matchingTextBlock != null)
                {
                    peer.ChildTextBlockPeer = FrameworkElementAutomationPeer.FromElement(matchingTextBlock) as TextBlockAutomationPeer;
                }
#endif

                peer.GetChildren();
                children.Add(peer);
            }

            CalendarMonthViewModel monthModel = this.CalendarOwner.Model.currentViewModel as CalendarMonthViewModel;
            if (monthModel != null)
            {
                foreach (CalendarHeaderCellModel headerModel in monthModel.CalendarHeaderCells)
                {
                    CalendarHeaderCellInfoAutomationPeer peer = calendarPeer.childrenCache
                                                                .OfType <CalendarHeaderCellInfoAutomationPeer>().FirstOrDefault(a => this.AreHeaderModelsEqual(a.HeaderCellModel, headerModel));

                    if (peer == null)
                    {
                        peer = new CalendarHeaderCellInfoAutomationPeer(this, headerModel);
                        calendarPeer.childrenCache.Add(peer);
                    }

                    children.Add(peer);
                }
            }

            return(children);
        }
示例#2
0
 public void Setup()
 {
     calendarMonthViewModel = new CalendarMonthViewModel();
 }