Is there a way to use a style setter for properties of properties?

前端 未结 2 442
感动是毒
感动是毒 2020-12-07 02:23

Edit: In the original question i made some wrong assumptions about how setters work so i modified it to hopefully be more accurate and useful.

2条回答
  •  执念已碎
    2020-12-07 03:07

    So after reading Meleak's answer and finding out that you can have a style within a style via resources what probably comes closest to doing this with a setter is an embedded style to access the icon's opacity. Here i assume the icon to be an image so i use that as the target type, the complete style hence looks like this:

    
        
        
            
                
                    
                        
                            
                            
                        
                    
                
            
            
                
                    
                        
                            
                            
                        
                    
                
            
        
    
    

    The only problem with this is that it does not actually set the Icon.Opacity but the opacity of all images that may occur within the MenuItem.

提交回复
热议问题