Exemplo n.º 1
0
        /// <summary>
        /// Callback called when the Content property's value has changed.
        /// </summary>
        /// <param name="d">Sender object</param>
        /// <param name="e">Callback arguments</param>
        private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ButtonBase3D bb = (ButtonBase3D)d;

            bb._button = (UIElement3D)bb.FindName("PART_Button");
            bb.InitializeButton();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Callback called when the IsPressed property's value has changed.
        /// </summary>
        /// <param name="d">Sender object</param>
        /// <param name="e">Callback arguments</param>
        private static void OnIsPressedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ButtonBase3D    bb = (ButtonBase3D)d;
            DoubleAnimation da = new DoubleAnimation();

            if (bb.IsPressed)
            {
                da.From = 0.0;
                da.To   = -1.0;
            }
            else
            {
                da.From = -1.0;
                da.To   = 0.0;
            }
            da.Duration = new Duration(TimeSpan.FromSeconds(0.2));
            bb.ApplyAnimationClock(PressEffectProperty, null);
            AnimationClock ac = da.CreateClock();

            bb.ApplyAnimationClock(PressEffectProperty, ac);
        }