Autosizing a grid column to take up remaining space in parent

后端 未结 2 1097
心在旅途
心在旅途 2020-12-20 13:46

In WPF, I am having a heck of a time trying to get a grid to size properly.

I have the following layout for my grid:



        
相关标签:
2条回答
  • 2020-12-20 13:51

    * means fill or share. If you had two with * then they would share the width evenly.

    <ColumnDefinition Width="*"/>
    
    0 讨论(0)
  • 2020-12-20 14:00

    Seems I found a solution after a bit more tinkering around.

    The problem was: <ColumnDefinition Width="Auto"/>

    This was causing the column to fit to the content. I changed it to: <ColumnDefinition />

    This causes the column to fit to the empty space left in the parent container, regardless of content size.

    0 讨论(0)
提交回复
热议问题