How to dynamically change a WPF control's template using a checkbox?

后端 未结 2 764
有刺的猬
有刺的猬 2021-02-06 09:12

I have an error dialog (shown simplified below).

I display the Report object in a ContentControl to which I have defined a Template sim

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-06 09:40

    You can use a DataTrigger in the ContentControl Style where you bind to the IsChecked property of the ChkShowDetails CheckBox

    
        
            
        
    
    

    Update

    Complete Xaml example, paste it and try it :)

    
        
            
        
        
            
                
                
                
            
        
    
    
        
            
            
        
        
            
                
            
        
        Show Details
    
    

提交回复
热议问题