I want to bind my window’s height to the StackPanel’s height. What is the easiest way to get the StackPanel’s content height?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The easiest way would be to use
MyStackPanel.ActualHeightsince aStackPanel'sheight is based off of the size of it’s contents.Edit
You’ll also want to set the
VerticalAlignmentof yourStackPanelto something other thanStretchif it is inside another panel which stretches it’s children by default, such as aGridor aDockPanel.