How do you override the opacity of a parent control in WPF?

后端 未结 3 1467
鱼传尺愫
鱼传尺愫 2020-12-08 09:54

When you set the opacity on a Grid in WPF, all the child elements appear to inherit its Opacity. How can you have a child element not inherit the p

3条回答
  •  时光取名叫无心
    2020-12-08 10:45

    You can just overlay two grids inside your layout grid. The first would be defined as your grid, minus your red innermost grid. The second would be defined with the same columns and rows, with a transparent background. The only child of this grid would be your innermost grid.

        
    
            
                
                    
                    
                    
                
                
                    
                    
                    
                
    
                
                     Here is some content in a somewhat transparent cell  
                
    
             
    
            
            
                
                    
                    
                    
                
                
                    
                    
                    
                
    
                
                    
                 
             
             
    

提交回复
热议问题