Use style trigger to set property of a nested object

前端 未结 3 1110
感动是毒
感动是毒 2020-12-06 06:21

I have a small polygon written on the large canvas. I want to highlight a polygon when mouse is moving over the canvas. The code is like this:



        
3条回答
  •  猫巷女王i
    2020-12-06 07:09

    You cannot use Setters like that, if you use this kind of notation the engine will look for an attached property, or if no Style.TargetType was set for a property on the type before the dot.

    The easiest thing to do is probably applying a style to the polygon itself and using a DataTrigger which binds to the Canvas so you can trigger on its properties.

      
           
               
           
           
              
           
      
    

提交回复
热议问题