Independent width in a WPF Grid

后端 未结 2 1707
一向
一向 2021-01-26 00:32

I have a grid with 2 rows and 2 columns in WPF. I would like that the column widths are independent for each row. I tried \"auto\", but no success. Here is a picture in order to

2条回答
  •  情深已故
    2021-01-26 00:44

    If you must use a grid layout, then you have a couple of options:

    Option 1: Make each row a single column and then nest a grid in each row you would like independent columns:

    XAML

    
        
            
            
        
    
        
    
        
          
            
            
          
    
          
          
        
    
    

    Option 2: Make use of ColumnSpan in the rows:

    XAML

    
      
        
        
      
    
      
        
        
      
    
          
          
          
        
    
    

    *These were typed without an editor and may need a bit of tweaking.

提交回复
热议问题