How can I create a Grid with it's X and Y axis bound to different collections?

前端 未结 3 1940
夕颜
夕颜 2021-01-07 07:49

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 b

3条回答
  •  旧巷少年郎
    2021-01-07 08:23

    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 CurrentWeek and ObservableCollection CurrentTasks

    • The Category class should have ObservableCollection Tasks

    • And Task should have ObservableCollection 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 :)

    Sample Layout

提交回复
热议问题