How do you keep the WPF window sized to content with an Expander after resize

前端 未结 5 547
伪装坚强ぢ
伪装坚强ぢ 2021-01-31 14:07

I\'ve got a WPF window with SizeToContent=\"Height\". This window contains an that displays a list of recent activity. What I\'d lik

5条回答
  •  北荒
    北荒 (楼主)
    2021-01-31 14:26

    You have to make your window non-resizeable if you're going to use SizeToContent. Also, you shouldn't use SizeToContent="Height", and then set an explicit Height. Think about it - which one should WPF believe for the window height, the user's setting or the Content? It can't just switch back and forth between the two.

提交回复
热议问题