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); }
protected override Freezable CreateInstanceCore() { StoryboardExtender p = new StoryboardExtender(); p.TargetElement = this.TargetElement; return(p); }
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; }
public void RestoreAnimation() { DoubleAnimation animHeight = new DoubleAnimation(stickyWindow.OriginalSize.Height, TimeSpan.FromMilliseconds(250)); DoubleAnimation animWidth = new DoubleAnimation(stickyWindow.OriginalSize.Width, 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 storyRestore = new StoryboardExtender(); storyRestore.Children.Add(animWidth); storyRestore.Children.Add(animHeight); storyRestore.Completed -= new EventHandler(animationsRestore_Completed); storyRestore.Completed += new EventHandler(animationsRestore_Completed); storyRestore.TargetElement = stickyWindow; storyRestore.Begin(stickyWindow.Owner); }
protected override Freezable CreateInstanceCore() { StoryboardExtender p = new StoryboardExtender(); p.TargetElement = this.TargetElement; return p; }
public void RestoreAnimation() { DoubleAnimation animHeight = new DoubleAnimation(stickyWindow.OriginalSize.Height, TimeSpan.FromMilliseconds(250)); DoubleAnimation animWidth = new DoubleAnimation(stickyWindow.OriginalSize.Width, 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 storyRestore = new StoryboardExtender(); storyRestore.Children.Add(animWidth); storyRestore.Children.Add(animHeight); storyRestore.Completed -= new EventHandler(animationsRestore_Completed); storyRestore.Completed += new EventHandler(animationsRestore_Completed); storyRestore.TargetElement = stickyWindow; storyRestore.Begin(stickyWindow.Owner); }
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); }