Пример #1
0
        private void UpdateItems()
        {
            IEnumerable <object> items = ItemsSource as IEnumerable <object>;

            if (items == null)
            {
                return;
            }

            if (TimelinePanel == null)
            {
                return;
            }

            TimelinePanel.Children.Clear();
            if (HeaderContent != null)
            {
                TimelinePanel.AddElementToPanel(HeaderContent);
            }

            foreach (var item in items)
            {
                TimelinePanel.AddElementToPanel(CreateItem(item));
            }
        }
Пример #2
0
        protected override void OnApplyTemplate()
        {
            if (TimelinePanel != null)
            {
                // clean up
                TimelinePanel.Children.Clear();
            }

            TimelinePanel = this.GetTemplateChild(PartTimelinePanel) as TimelinePanel;

            if (TimelinePanel != null)
            {
                UpdateItems();
            }

            KeyDown  += Timeline_KeyDown;
            KeyUp    += Timeline_KeyUp;
            GotFocus += Timeline_GotFocus;

            base.OnApplyTemplate();
        }