如何创建一个网格与它的X和Y轴绑定到不同的收藏品? [英] How can I create a Grid with it's X and Y axis bound to different collections?

查看:143
本文介绍了如何创建一个网格与它的X和Y轴绑定到不同的收藏品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要显示的东西,显示沿列日的一个星期,并沿行分类的列表,并在细胞内到期的任务列表(见下图)



我觉得解决方案应该是简单的,但我画一个空白就如何结合这样的事情。



无论是行,列和单元格的数据项是动态的,基于什么周用户观看,最好我想隐藏那些没有对当前查看的周任何任务的类别。我对当前查看的周,类别列表和任务列表集合属性,每个任务都有一个与之关联的交货期和类别....





修改



我的数据库看起来是这样的:



任务表

 TASKID 
的CategoryId
OtherProperties

< STRONG>任务实例表

 TaskInstanceId 
ParentTaskId
DUEDATE

我必须能够接受一定范围的日期,并返回下面的类的列表的存储过程(需要计算重复事件)

 
TaskInstanceId
ParentTaskId
名称

DUEDATE
OtherProperties

我是想用它包含

 日期$ b $第3类来做到这一点b文件清单<任务> 


解决方案

我想我可能已经找到一种方法来做到这一点......我需要重新安排我的数据位




  • 我的主视图模型将包含的ObservableCollection< DateTime的> ; CurrentWeek 的ObservableCollection<类别及GT; CurrentTasks


  • 类别类应该有的ObservableCollection<任务>任务


  • 任务应该有的ObservableCollection< TaskInstances> OCCURENCES



主视图模型还应该订阅 CurrentWeek.CollectionChanged ,以及基于什么日期都在收集,更新每个 Category.Task [X] .Occurences 如果 Category.Task。 IsRecurring ==真



然后我想我可以使用下面的结构来得到我想要的东西。当我知道我会更新这个职位,如果这个工程或不



更新:它的工作原理:)




I need to display something that shows a Week of days along the Columns, and a list of Categories along the Rows, and a list of Tasks that are due in the Cells (See sketch below)

I feel like the solution should be simple, but I'm drawing a blank as to how to bind such a thing.

Both the Rows, Columns, and data items in the Cells are dynamic based on what week the user is viewing, and ideally I'd like to hide categories that do not have any tasks for the currently viewed Week. I have collection properties for the currently Viewed Week, the list of Categories, and the list of Tasks, and each Task has a DueDate and Category associated with it....

Edit

My database looks like this:

TASK TABLE

TaskId
CategoryId
OtherProperties

TASK INSTANCE TABLE

TaskInstanceId
ParentTaskId
DueDate

I have a stored procedure that accepts a range of dates and returns a list of the following class (need to calculate recurring events)

TaskInstanceId
ParentTaskId
Name
Category
DueDate
OtherProperties

I was trying to do this with a 3rd class which contains

Date
List<Task>

解决方案

I think I might have found a way to do it... I need to rearrange my Data a bit

  • My main ViewModel will contain ObservableCollection<DateTime> CurrentWeek and ObservableCollection<Category> CurrentTasks

  • The Category class should have ObservableCollection<Task> Tasks

  • And Task should have ObservableCollection<TaskInstances> Occurences

The main ViewModel should also subscribe to CurrentWeek.CollectionChanged, and based on what the dates are in the collection, update each Category.Task[x].Occurences if Category.Task.IsRecurring == true

Then I think I can use the following structure to get what I want. I'll update this post when I know if this works or not

Update: It works :)

这篇关于如何创建一个网格与它的X和Y轴绑定到不同的收藏品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆