Ejemplo n.º 1
0
        /// <summary>
        /// Присоединяет поведние к объекту зависимостей.
        /// </summary>
        /// <param name="associatedObject">Объект, к которому присоединяется поведение.</param>
        public void Attach(DependencyObject associatedObject)
        {
            AssociatedObject = associatedObject;

            listView = associatedObject as ListViewBase;
            if (listView == null)
            {
                return;
            }

            timer.Tick      += Timer_Tick;
            listView.Loaded += (s, e) =>
            {
                sv = listView.GetFirstOrDefaultDescendantOfType <ScrollViewer>();
                if (sv == null)
                {
                    return;
                }

                Timer_Tick(null, null);
                timer.Start();
            };
        }