Specify the max number of columns for a WrapPanel in WPF

前端 未结 4 509
广开言路
广开言路 2021-02-07 03:13

I have a WrapPanel, And I want to specify the Max number of its columns. So, for example, when my Collection \"ObjectCollection\" (binded to this WrapPanel) contains only 4 elem

4条回答
  •  一整个雨季
    2021-02-07 03:53

    I'm pretty sure you can't do it with a WrapPanel, but you can use the UniformGrid instead.

    That one has properties to specify the number of rows and columns you want.

    If you set the Columns property to 4, it will keep 4 items in each row, and then wrap to the next one.

    
        
        
        
        
        
    
        
        
    
    

提交回复
热议问题