开发者

How to display a line in a listbox depending on the date value of the previous and next binded items?

I have a listbox with binded items. The items come from a collection, and have a date as a property.

I would like to display a line between two items of the listbox if the difference between their date is superior to 12 hours.

I don't know how to handle the fact that the code should look at 2 items in the collection and compare the values to display or not display the line.

I am a beginner so detai开发者_JAVA百科ls will be apreciated :) Many thanks for your help. Best, Arthur


Well, you don't have the ability to see what the next item is directly from XAML, so what you can do, is to calculate it in code, and insert a different element that denotes there to be a line.

Then you can use a DataTemplateSelector to allowing you to have different data-templates based on a condition (like a boolean "IsLine").

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜