简体   繁体   English

WPF TabControl 在选项卡项内添加矩形

[英]WPF TabControl adding rectangles inside tab items

I have a data table containing floor/storie/level information- using this information (I add tab items to tab contol) The number of levels are not predetermined, this is determined by the user.我有一个包含楼层/故事/级别信息的数据表 - 使用此信息(我将选项卡项添加到选项卡控制) 级别数不是预先确定的,这是由用户确定的。 There is also another table for the room information, this table contains flood ID which is connected to the 'floors' data ID.房间信息还有另一个表,该表包含连接到“楼层”数据 ID 的洪水 ID。 I want to create rectangles for the rooms and place these rectanges where the rooms/floors are.我想为房间创建矩形并将这些矩形放置在房间/地板所在的位置。 I would appreciate any feedback on how to execute this opperation.我将不胜感激有关如何执行此操作的任何反馈。

You could store the rooms in a Dictionary<int, List<Room>> using the floor data ID as the index.您可以使用楼层数据 ID 作为索引将房间存储在Dictionary<int, List<Room>>中。 The int would be the ID of your floor (assuming it is a number), and the List would be the list of rooms on that floor. int 将是您所在楼层的 ID(假设它是一个数字),而 List 将是该楼层的房间列表。

If this answer is headed in the wrong direction, perhaps you can post some sample code.如果这个答案的方向错误,也许您可以发布一些示例代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM