private void PersistWindowDefaultPosition(IWindowMetadataProvider windowInfo, FrameworkElement viewWithDataContext) { if (!this.windowsAttributes.ContainsKey(windowInfo)) { var top = WindowPosition.GetWindowTop(windowInfo.VerticalPosition, ((FrameworkElement)this.HostControl).ActualHeight, viewWithDataContext.Height); var left = WindowPosition.GetWindowLeft(windowInfo.HorizontalPosition, ((FrameworkElement)this.HostControl).ActualWidth); this.windowsAttributes[windowInfo] = new Point(left, top); } }
private double GetWindowLeft(object view, IWindowMetadataProvider windowInfo) { var persistedValue = (double?)this.windowManager.RecoverProperty(view.GetType().ToString(), "PositionX"); if (persistedValue.HasValue) { return(persistedValue.Value); } return(WindowPosition.GetWindowLeft(windowInfo.HorizontalPosition, ((FrameworkElement)this.HostControl).ActualWidth)); }
private double GetWindowTop(object view, IWindowMetadataProvider windowInfo, FrameworkElement viewWithDataContext) { var persistedValue = (double?)this.windowManager.RecoverProperty(view.GetType().ToString(), "PositionY"); if (persistedValue.HasValue) { return(persistedValue.Value); } return(WindowPosition.GetWindowTop(windowInfo.VerticalPosition, ((FrameworkElement)this.HostControl).ActualHeight, viewWithDataContext.Height)); }
private Size GetWindowSize(object view, IWindowMetadataProvider windowInfo) { var height = (double?)this.windowManager.RecoverProperty(view.GetType().ToString(), "Height"); var width = (double?)this.windowManager.RecoverProperty(view.GetType().ToString(), "Width"); if (height.HasValue && width.HasValue) { Size windowSize = new Size { Height = height.Value, Width = width.Value }; return(windowSize); } return(windowInfo.Size); }