WPF Mouseover Trigger Effect for Child Controls

后端 未结 2 894
旧巷少年郎
旧巷少年郎 2021-01-05 00:03

Lets say I have this bit of code:


    
        

        
2条回答
  •  一生所求
    2021-01-05 00:30

    You can do it the other way around. That is, add DataTriggers to Image and TextBlock and make them trigger on IsMouseOver for the ancestor Grid.

    Note: If you want this effect to trigger as soon as the mouse is over the Grid you will need to set Background to a value, like Transparent. By default, the Background is null and this value isn't used in hit testing.

    
            
        
    
    

提交回复
热议问题