How can I make a WPF Expander Stretch?

后端 未结 8 815
醉酒成梦
醉酒成梦 2020-12-29 02:34

The Expander control in WPF does not stretch to fill all the available space. Is there any solutions in XAML for this?

8条回答
  •  长情又很酷
    2020-12-29 03:14

    I am pretty surprised nobody has mentioned to just edit the control template, all the other solutions have some pretty serious drawbacks weather its not calculating width properly, not redrawing, render time etc...

    This control template will modify the header's contentpresenter horizontal alignment to match the actual expanders (meaning it will stretch)

        
            
                
                    
                        
                            
                        
                        
                            
                        
                    
                    
                
            
            
                
                    
                
                
                    
                    
                    
                        
                            
                        
                    
                
                
                    
                    
                    
                        
                            
                        
                    
                
                
                    
                    
                    
                        
                            
                        
                    
                
                
                    
                
            
        
    

提交回复
热议问题