Spacing between child controls in WPF Grid

前端 未结 3 1228
臣服心动
臣服心动 2021-01-31 14:13

I have a set of Key/Value pairs I want to display on a WPF Window. I\'m using a grid to lay them out like so:


    

        
3条回答
  •  渐次进展
    2021-01-31 14:40

    Easiest way is to set a margin on the individual controls. Setting it on the TextBoxes should be enough, because once they're spaced out the Labels will set vertically in the center of each row and have plenty of space anyway.

    You can set it once using a style:

    
        
            
        
    
        ...
    
    

    This will add a 4-pixel margin to the bottom of any TextBox inside your grid.

提交回复
热议问题