我需要做如下图所示的事情:
处置 http://img560.imageshack.us/img560/8721/dispo16042013134903.png
水平滚动时需要冻结人员(1),垂直滚动时需要冻结日期(2)。所以总是可以说这个 $Person 在 $Date 上做 ...(4)。此外,还需要显示该人每天做某事的附加信息(3)。
我的数据结构目前是:Person -> Dictionary of Days -> ObservableCollection of what is done on this day (可以是多件事)
我怎样才能以一种好的 WPF 方式做到这一点?最好是这样我只能将 DataContext 设置为我的 Person 集合,其他一切都由 WPF 完成。
我感谢您的帮助。
编辑:
Public Class DispoPersonViewModel
Inherits ViewModelBase
Implements iScheduleOrganizer
Private _dbContext As infosoftEntities
Private WithEvents _Person As Person
Private _DictAZGSchedule As New Concurrent.ConcurrentDictionary(Of Date, DispoAZGScheduleViewModel)
Public Sub New(ByVal Person As Person, Optional ByVal dbContext As IDBContext
'Getting the data for the person
End Sub
Public ReadOnly Property AZGSchedule(ByVal dat As Date) As BusinessObjects.AZG.AZGSchedule Implements iScheduleOrganizer.AZGSchedule
Get
Return Me._Person.AZGSchedule(dat)
End Get
End Property
'I omit the whole load and initialize and check functions here
End Class
和
Public Class DispoAZGScheduleViewModel
Inherits ViewModelBase
Private _Person As DispoPersonViewModel
Private WithEvents _AZGSchedule As AZG.AZGSchedule
Private WithEvents _lSchedule As ObservableCollection(Of DispoScheduleViewModel)
Public Sub New(AZGEinteilung As AZG.AZGSchedule, Person As DispoPersonViewModel)
'initializing the AZGSchedule
Using CSTeile.MyStack.Push("DispoAZGScheduleViewModel.New")
_AZGEinteilung = AZGEinteilung
_Person = Person
Dim lSched As New ObservableCollection(Of DispoScheduleViewModel)
For Each sc As Schedule In _AZGSchedule.ListAllSchedules.ToList
lSched.Add(New DispoScheduleViewModel(et, _Person, Me))
Next
_lSchedule = lSched
End Using
End Sub
Public ReadOnly Property ListAllSchedules As List(Of DispoScheduleViewModel)
Get
Using CSTeile.MyStack.Push("DispoAZGScheduleViewModel.ListAllEinteilung")
Return _lEinteilung.ToList
End Using
End Get
End Property
Public ReadOnly Property fc As AZG.AGZErrorCache 'for displaying errors
Get
Using CSTeile.MyStack.Push("DispoAZGScheduleViewModel.fc")
Return Me._AZGSchedule.fc.Result
End Using
End Get
End Property
'I omit here the whole hookup to my BussinessObjects it would get to much
End Class
现在我在代码隐藏中“构建”了整个东西,它并没有做我想做的所有事情,而且渲染速度很慢:-(。