Ejemplo n.º 1
0
        /// <summary>
        /// 设置AduTimelineItem的位置属性
        /// </summary>
        /// <param name="index"></param>
        private void SetAduTimelineItem(int index)
        {
            if (index > this.Items.Count || index < 0)
            {
                return;
            }

            AduTimelineItem AduTimelineItem = this.ItemContainerGenerator.ContainerFromIndex(index) as AduTimelineItem;

            if (AduTimelineItem == null)
            {
                return;
            }
            AduTimelineItem.IsFirstItem  = index == 0;
            AduTimelineItem.IsLastItem   = index == this.Items.Count - 1;
            AduTimelineItem.IsMiddleItem = index > 0 && index < this.Items.Count - 1;
        }
Ejemplo n.º 2
0
        protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
        {
            int             index        = this.ItemContainerGenerator.IndexFromContainer(element);
            AduTimelineItem timelineItem = element as AduTimelineItem;

            if (timelineItem == null)
            {
                return;
            }

            if (index == 0)
            {
                timelineItem.IsFirstItem = true;
            }

            if (index == this.Items.Count - 1)
            {
                timelineItem.IsLastItem = true;
            }

            base.PrepareContainerForItemOverride(timelineItem, item);
        }