Esempio n. 1
0
        public void MinimizeAnimation()
        {
            //Minimize Animation
            stickyWindow.MinHeight            = 0;
            stickyWindow.MinWidth             = 0;
            stickyWindow.ResizeMode           = ResizeMode.NoResize;
            stickyWindow.OriginalSize         = new Size(stickyWindow.ActualWidth, stickyWindow.ActualHeight);
            stickyWindow.MyWindowState        = WindowState.Minimized;
            stickyWindow.sSlider.MyVisibility = Visibility.Hidden;

            MyTextBox txt = stickyWindow.sTextArea;

            txt.PreviousActiveState = txt.ActiveState;
            txt.ActiveState         = TextBoxActiveState.Inactive;
            txt.TextWrapping        = TextWrapping.NoWrap;

            DoubleAnimation animHeight = new DoubleAnimation(stickyWindow.ActualHeight, 20, TimeSpan.FromMilliseconds(250));
            DoubleAnimation animWidth  = new DoubleAnimation(stickyWindow.ActualWidth, 20, TimeSpan.FromMilliseconds(250));

            Storyboard.SetTargetName(animHeight, stickyWindow.Name);
            Storyboard.SetTargetProperty(animHeight, new PropertyPath(Window.HeightProperty));

            Storyboard.SetTargetName(animWidth, stickyWindow.Name);
            Storyboard.SetTargetProperty(animWidth, new PropertyPath(Window.WidthProperty));

            StoryboardExtender storyMin = new StoryboardExtender();

            storyMin.Children.Add(animWidth);
            storyMin.Children.Add(animHeight);

            storyMin.Begin(stickyWindow.Owner);
        }
Esempio n. 2
0
        void animationsRestore_Completed(object sender, EventArgs e)
        {
            Clock c = sender as Clock;
            StoryboardExtender sbe = c.Timeline as StoryboardExtender;
            StickyWindowModel  sw  = sbe.TargetElement as StickyWindowModel;

            sw.MinHeight     = 50;
            sw.MinWidth      = 100;
            sw.ResizeMode    = ResizeMode.CanResizeWithGrip;
            sw.MyWindowState = WindowState.Normal;

            MyTextBox txt = sw.sTextArea;

            txt.ActiveState  = txt.PreviousActiveState;
            txt.TextWrapping = TextWrapping.Wrap;
        }
        void txt_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            MyTextBox txt = sender as MyTextBox;

            txt.ActiveState = TextBoxActiveState.Active;
        }
        void txt_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            MyTextBox txt = sender as MyTextBox;

            txt.ActiveState = TextBoxActiveState.Inactive;
        }