WPF DataGrid different edit controls within a single column

后端 未结 2 1684
灰色年华
灰色年华 2021-01-01 04:20

I am developing a WPF 4.0 application where I need to make a grid that contains a column with either textbox or a dropdown depending on the row. Example:

| N         


        
2条回答
  •  余生分开走
    2021-01-01 04:31

    You can do that using a template column.

    This one will show one or two text boxes depending on the data in the row.

    The CellTemplate is shown normally, but it is replaced with CellEditingTemplate when the row is edited.

    
        
            
                
            
        
    
        
            
                
                    
                        
                        
                    
                    
                        
                        
                    
    
    
                    
                    
    
                    
                    
    
                
            
        
    
    

提交回复
热议问题