I have a user resizable WPF Window that I want to constrain the resizing so the aspect ratio of the window stays constant.
Ideally I would like to constrain mouse
Does that do the trick:
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) { if (sizeInfo.WidthChanged) this.Width = sizeInfo.NewSize.Height * aspect; else this.Height = sizeInfo.NewSize.Width / aspect; }
Found it here.