开发者

WPF: Expand collection item across multiple ItemsControl (MS Outlook month view)

I am trying to make a control which would have functionalities similar to the MS Outlook month view calendar. In fact, I did manage to make the entire control, but I bumped into an problem and now I am stuck. Here's how I implemented it:

I have created an ItemsCollection MonthView container which is vertically oriented. That container contains a collection of horizontally oriented ItemsCollection WeekView - each of those controls represents one week row in the calendar. Every WeekView contains a collection of ItemsCollection Da开发者_JAVA百科yView controls which is vertically oriented container and is used to store appointments. Here's a picture that illustrates all this:

WPF: Expand collection item across multiple ItemsControl (MS Outlook month view)

Each DayView collection is binded to the List<Appointment> Appointments list and has a filter to show only those appointments which are scheduled for that particular day. It all looks swell, but here's a catch: If an Appointment appointment is scheduled for more than one day (multiple days activity), the same entry is visible in more than one DayView container, which is logical.

I would like to have one appointment control to spread across mulitple DayViews if scheduled for more than one day. I don't know how to implement this. Could anyone please let me know what do I need to change in my design and how to define the template for the Appointment in order to support this requirement? Thank you.


This is a bit tricky, given how much you have already created. I can't test this out at the moment, but you may be able to use one of the Transform class implementations (link to ScaleTransform) provided by WPF and apply it in the RenderTransform phase of the presentation. Using this technique, you would be able to have one of your appointments drawn overtop of two DayView controls without having to change too much.

Here is a link to an article that demonstrates the technique.

Be aware that this will cause other problems that you will have to deal with, the most likely of which is when you have an appointment that spans 2 days and a single day appointment in the second day. This technique will cause them overlap.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜