开发者

UserControl Width is Nan while it's ActualWidth set to the Column it placed on

开发者 https://www.devze.com 2023-02-14 11:41 出处:网络
I have a UserControl, I do not set it\'s Width / Height, the UserControl has 2 TextBox inside a 开发者_Go百科StackPanel.

I have a UserControl, I do not set it's Width / Height, the UserControl has 2 TextBox inside a 开发者_Go百科StackPanel. when I place it in a Column where it's Width="Auto", the control stretches to fill the entire column, while the 2 TextBox maintain their Width (desire) I want to keep the Control Width to it's Content Width, how to I do that ?


HorizontalAlignment="Left"

This will keep the Control from stretching based on the container which it resides and instead will expand based on its contents if the Width is set to Auto.

MSDN provides an overview on Alignment, Margins, and Padding which may be of assistance.

0

精彩评论

暂无评论...
验证码 换一张
取 消