How to make itemtemplate aware of its containing template?

前端 未结 1 994
挽巷
挽巷 2021-01-23 23:27

I want this Ellipse to get its coordinates from its corresponding BallViewModel, and to use them to determine its location inside a canvas. The list of balls is bound to L

1条回答
  •  死守一世寂寞
    2021-01-24 00:02

    When you use an ItemTemplate with an ItemControls it does not directly put your Elippses on the Canvas but wraps them into an ContentPresenter. So you have to apply your canvas.Bottom/Left properties on the ItemsPresenter. You can can do this with the ItemContainerStyle:

    
                
     
    
                
                    
                
     
    

    0 讨论(0)
提交回复
热议问题