/// <summary>
        /// Applies the mouse down behavior.
        /// </summary>
        /// <param name="selectedIndex">The selected item index.</param>
        /// <param name="element">The element of concern.</param>
        public virtual void ApplyMouseDownBehavior(int selectedIndex, CoolMenuItem element)
        {
            if (!BounceEnabled)
                return;

            m_mouseCaptured = element.CaptureMouse();

            var da = new DoubleAnimationUsingKeyFrames();
            var k1 = new SplineDoubleKeyFrame
            {
                KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(100)),
                Value = this.MaxItemHeight * 0.30
            };
            da.KeyFrames.Add(k1);

            Storyboard sb = new Storyboard();
            Storyboard.SetTarget(da, element);
            Storyboard.SetTargetProperty(da,
                new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)"));
            sb.Children.Add(da);
            sb.Begin();
        }
 /// <summary>
 /// Creates a new instance of the SelectedMenuItemArgs class.
 /// </summary>
 /// <param name="menuItem">The currently selected menu item</param>
 /// <param name="menuIndex">The index of the currently selected menu item.</param>
 public SelectedMenuItemArgs(CoolMenuItem menuItem, int menuIndex)
 {
     m_cmi = menuItem;
     m_index = menuIndex;
 }
        /// <summary>
        /// Applies the mouse enter behavior.
        /// </summary>
        /// <param name="proximity">The proximity of the element which is selected.</param>
        /// <param name="element">The element of concern.</param>
        public virtual void ApplyMouseEnterBehavior(int proximity, CoolMenuItem element)
        {
            if (proximity >= m_sizes.Length || proximity < 0)
                proximity = m_sizes.Length - 1;

            TimeSpan speed = TimeSpan.FromMilliseconds(100);
            DoubleAnimation daWidth = new DoubleAnimation { To = m_sizes[proximity] * MaxItemWidth, Duration = new Duration(speed) };
            DoubleAnimation daHeight = new DoubleAnimation { To = m_sizes[proximity] * MaxItemHeight, Duration = new Duration(speed) };
            Storyboard sb = new Storyboard();
            Storyboard.SetTarget(daWidth, element);
            Storyboard.SetTarget(daHeight, element);
            Storyboard.SetTargetProperty(daHeight, new PropertyPath("(UIElement.Height)"));
            Storyboard.SetTargetProperty(daWidth, new PropertyPath("(UIElement.Width)"));
            sb.Children.Add(daWidth);
            sb.Children.Add(daHeight);
            sb.Begin();
        }
 /// <summary>
 /// Initializes each element in the cool menu.
 /// </summary>
 /// <param name="parent">The parent CoolMenu.</param>
 /// <param name="element">The element of concern.</param>
 public virtual void Initialize(CoolMenu parent, CoolMenuItem element)
 {
     element.Height = MaxItemHeight * m_sizes[m_sizes.Length - 1];
     element.Width = MaxItemWidth * m_sizes[m_sizes.Length - 1];
 }
 /// <summary>
 /// Does nothing in this implementation.
 /// </summary>
 /// <param name="element">The element of concern.</param>
 public virtual void ApplyMouseLeaveBehavior(CoolMenuItem element)
 {
     // Do nothing.
 }
 public override void Initialize(CoolMenu parent, CoolMenuItem element)
 {
     base.Initialize(parent, element);
     element.Background = new SolidColorBrush(Colors.Yellow);
 }