private void window_Loaded(object sender, RoutedEventArgs e) { Rect r = WindowLocator.GetWorkingAreaOf(this); _maxSize = r.Size; _maxSizeInitialized = true; MaxWidth = _maxSize.Width / 2; MaxHeight = _maxSize.Height * 2 / 3; }
private void window_LayoutUpdated(object sender, EventArgs e) { if (_maxSizeInitialized && SizeToContent != SizeToContent.Manual) { SizeToContent = SizeToContent.Manual; Rect r = WindowLocator.GetWorkingAreaOf(this); MaxWidth = r.Width; MaxHeight = r.Height; } }