Window sizing constraints by content
- by EFraim
I want the window to respect MinWidth/MinHeight and MaxWidth/MaxHeight specifications of the content control inside.
Some suggested using SizeToContent, but this only helps to set the initial window size, not the constraints.
Others suggested overriding MeasureOverride and setting window's Min/Max height and width there, but this seems to be somewhat unclean, considering that such a trivial problem should surely have a purely declarative solution.
Just to mention another solution which seems reasonable but does not work (and had been previously mentioned in an answer which got deleted): binding MinWidth of the window to MinWidth of the control does not take into account window decorations.