Inheritance: System.Windows.Controls.UserControl
Esempio n. 1
0
        void SetUpHoverAnimationControl()
        {
            var panel = this.AssociatedObject.Parent as Panel;

            this.canvas = panel.FindName(CanvasName) as Canvas;

            if (this.canvas == null)
            {
                this.canvas      = new Canvas();
                this.canvas.Name = CanvasName;
                panel.Children.Add(this.canvas);
            }

            // re-use an existing hover control if it is found
            var existingHoverControl = canvas.FindName(ProgressIndiciatorName);

            if (existingHoverControl != null)
            {
                this.hoverProgressControl = (HoverProgressControl)existingHoverControl;
            }
            else
            {
                this.hoverProgressControl            = new HoverProgressControl();
                this.hoverProgressControl.Name       = ProgressIndiciatorName;
                this.hoverProgressControl.Visibility = Visibility.Collapsed;
            }
            this.hoverProgressControl.Storyboard.Completed += new EventHandler(Storyboard_Completed);
            this.canvas.Children.Add(this.hoverProgressControl);
        }
Esempio n. 2
0
        protected override void OnDetaching()
        {
            base.OnDetaching();

            this.AssociatedObject.MouseEnter -= AssociatedObject_MouseEnter;
            this.AssociatedObject.MouseLeave -= AssociatedObject_MouseLeave;
            this.AssociatedObject.MouseMove  -= AssociatedObject_MouseMove;
            this.hoverProgressControl.Storyboard.Completed -= Storyboard_Completed;

            this.hoverProgressControl = null;
        }