Wpf control size to content?

后端 未结 4 1225
旧巷少年郎
旧巷少年郎 2020-12-13 12:11

How do I make a WPF control to change its size according the content in it?

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 12:25

    I had a user control which sat on page in a free form way, not constrained by another container, and the contents within the user control would not auto size but expand to the full size of what the user control was handed.

    To get the user control to simply size to its content, for height only, I placed it into a grid with on row set to auto size such as this:

    
        
            
        
        
    
    

提交回复
热议问题