需要一个“网格”用作日历的堆栈面板

发布于 2024-12-21 12:33:55 字数 552 浏览 3 评论 0原文

最终,我的目标是拥有一个由小型堆栈面板组成的网格(我所说的网格是指行和列,无论它是如何实现的)来表示一天中的时间间隔。我认为与以下内容不太相似(右侧的简单日历类型布局):


(来源:msdn.com)

我需要一种动态创建此网格并在事件触发时适当命名面板的方法(具体来说 -放置事件,每个面板的放置事件将连接到相同的方法,在该方法中我必须区分项目被放置在哪个面板上(即在一天中的什么时间点,以及在哪一行)。

非常感谢您的帮助!

Ultimately, my aim is to have a grid (by grid I mean rows and columns, however it's achieved) of small stack panels to represent time intervals throughout a day. Not too disimilar from the following I suppose (simple calendar-type layout on the right):


(source: msdn.com)

I need a way of creating this grid dynamically and naming the panels appropriately for whenever an event is fired (to be specific - a drop event, each panel's drop event will be wired to the same method in which I must distinguish what panel (i.e. at what point in the day, and on what row) the item was dropped on).

Thanks a LOT for any help!

Dan

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

墨洒年华 2024-12-28 12:33:55

您可能无法从此处获得执行此操作的完整代码,但我可以为您指出正确的方向。

您可能想要使用嵌套的 ItemsControl。我过去做过类似的事情,日历的外部 ItemsControl 是一个 Grid,网格单元格包含一个内部 ItemsControl 和一个TaskItemsStackPanel

最重要的部分是让数据层正确。我使用了 CalendarDayModel 类,它具有 Date 属性和 ObservableCollection 列表。它还具有处理用户事件的命令,例如双击事件。

我的外部 ItemsControl 绑定到 ObservableCollection ,内部 ItemsControl 绑定到 ObservableCollection >

我有一些 ItemsControl 的示例 此处,但请注意最后一个使用网格的示例。

You probably won't get the full code to do that from here, but I can point you in the right direction.

You are probably going to want to use nested ItemsControl. I have done something like this in the past where my outer ItemsControl for the Calendar was a Grid, and grid cell contained an inner ItemsControl with a StackPanel of TaskItems.

The most important part is getting your data layer right. I used CalendarDayModel classes, which had a Date property and an ObservableCollection<TaskModel> list. It also had Commands to handle user events, such as double-click events.

My outer ItemsControl was bound to the ObservableCollection<CalendarDayModel> and the inner ItemsControl were bound to the ObservableCollection<TaskModel>

I have some examples of an ItemsControl here, but take note of the last example that uses a Grid.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文