DataTemplate.DataType = Collection< Entity&gt ;?

编程入门 行业动态 更新时间:2024-10-22 04:59:18
本文介绍了DataTemplate.DataType = Collection< Entity&gt ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否有一种方法可以创建处理项目列表的数据模板?

Is there a way to create a data template that handles a list of items?

我有Contact.Phones( EntityCollection< Phone> ),然后我希望数据模板处理列表-添加删除编辑等。

I have Contact.Phones (EntityCollection<Phone>) and I want the data template to handle the list - add remove edit etc.

有没有一种方法可以设置将DataTemplate转换为通用 EntityCollection< Phone> ?

Is there a way to set the DataType property of the DataTemplate to generic EntityCollection<Phone>?

推荐答案

包装通用列表在一个新类中,该类将泛型列表子类化而无需添加任何内容。 这样可以从XAML绑定到列表。 此处描述: 我可以指定XAML(.NET 4之前的框架)中的通用类型?

Wrap your generic list in a new class, which subclasses your generic list without adding anything. This makes it possible to bind to the list from XAML. This is described here: Can I specify a generic type in XAML (pre .NET 4 Framework)?

更多推荐

DataTemplate.DataType = Collection&lt; Entity&gt ;?

本文发布于:2023-11-07 05:30:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1565670.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Collection   DataType   DataTemplate   amp   gt

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!