Window sizing constraints by content
Posted
by
EFraim
on Stack Overflow
See other posts from Stack Overflow
or by EFraim
Published on 2012-09-03T11:48:18Z
Indexed on
2012/12/09
5:05 UTC
Read the original article
Hit count: 167
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.
© Stack Overflow or respective owner