private void ExpandParentWindow() { if( _currentState != AutoHideState.Collapsed ) return; _currentState = AutoHideState.Opening; if( _mode.IsHorizontalCollapse() ) { AnimateTransition( Window.LeftProperty, _mode == AutoHideMode.CollapseRight ? _params.CollapsedWidth - _originalParentSize.Width : 0, Window.WidthProperty, _originalParentSize.Width, () => _currentState = AutoHideState.Visible ); } else { AnimateTransition( Window.TopProperty, _mode == AutoHideMode.CollapseRight ? _params.CollapsedHeight - _originalParentSize.Height : 0, Window.HeightProperty, _originalParentSize.Height, () => _currentState = AutoHideState.Visible ); } }
/// <summary> /// Initializing constructor /// </summary> /// <param name="parent">Reference to the parent window</param> /// <param name="parameters">Auto-hider configuration settings</param> public WindowAutoHider( Window parent, WindowAutoHiderParams parameters ) { _parent = parent; _mode = AutoHideMode.None; _currentState = AutoHideState.Visible; _params = parameters; _dropHelper = new DropHelper( parent ); // This code may appear silly to an untrained eye, but if it's not here, even though 'parent.Left' has // a valid value, when we try animate it we might get an exception because DoubleAnimation might read it // as NaN. It's fine everywhere else, only the animation is screwed up. parent.Left = parent.Left; parent.Top = parent.Top; }