WPF: Binding lists in XAML- how can an item know its position in the list?

后端 未结 3 456
不知归路
不知归路 2021-01-05 08:19

Given the following XAML code that with a ListControl like behavior:

    
        

        
3条回答
  •  死守一世寂寞
    2021-01-05 08:32

    According to MSDN Magazine article "Charting with DataTemplates":

    [...]the DataTemplate would need access to the index of the particular data item in the collection. But it's easy enough to include this information in the business object[...]

    So, unless there was a change in .NET 4, there is no "index of this item" property unless it is explicitly included in the model.

提交回复
热议问题