开发者

WPF Custom Control containing a List of Objects

开发者 https://www.devze.com 2023-01-01 15:27 出处:网络
I have an object Trip in my object model containing a list of Nodes (e.g. NodeName, StartDate and EndDate) and I am trying to build a Custom control in WPF that draws list of rectangles: one for each

I have an object Trip in my object model containing a list of Nodes (e.g. NodeName, StartDate and EndDate) and I am trying to build a Custom control in WPF that draws list of rectangles: one for each Node contained in the Trip object (based on StartDate en EndDate)

Would you have any hint on how the Custom Control should be structured so that I can bind a 开发者_运维技巧Trip object to it and draw the rectangles properly, please?


You don't need to write a Custom Control for this. Ideally you would use the TreeView for this an write a HierachicalDataTemplate for the Trip object. Additionally you might need change the ControlTemplate of the TreeView too. Going this route is IMHO easier and less error prone.

0

精彩评论

暂无评论...
验证码 换一张
取 消