在Silverlight中创建通用组件以接受任何类型的集合 [英] Creating Generic Component in silverlight to accept any type of collection
问题描述
我正在尝试创建一个通用组件,该组件将带有带有搜索按钮的自动完成框,当我不知道要在自动完成中搜索的关键字时,我可以使用该搜索按钮,以便一个子窗口将打开并列出记录,以便我将选择所需的,以便将其放入自动填充框,
此用户控件将接受特定类型的通用集合,比如说"X",自动完成功能和datagrid仅在此X类型下工作,
但是这里的问题是我总是需要基于X类型创建集合以提供给usercontrol
但是我需要使此用户控件获取任何类型的集合,而不是坚持使用X类型,这基于自动完成和datagrid需要工作的类型
等待解决方案
在此先感谢
Hi,
I am trying to create one generic component that will have autocomplete box with search button ,when i dont know the keyword to search in autocomplete i can use that search button so that one child window will open and it will list the records so that i will choose the reqired one so that it will come in autocomplet box ,
this usercontrol will accept the generic collection of specific type lets say "X" ,the autocomplete and datagrid is working under this X type only ,
but the problem here is i always need to create the collection based on X type to supply for usercontrol
but i need to make this usercontrol to get any type of collection instead of sticking with X type ,based on the type the autocomplete and datagrid need to work
Waiting for the solution
Thanks in advance
推荐答案
一个类型为System.Collection.Generic的类可能会为您解决问题.
请参阅 http://msdn.microsoft.com/zh-我们/library/system.collections.generic(v=VS.95).aspx [
A class of type System.Collection.Generic should probably do the trick for you.
See http://msdn.microsoft.com/en-us/library/system.collections.generic(v=VS.95).aspx[^].
Pick up the top most class in the collection class hirearchy.
这篇关于在Silverlight中创建通用组件以接受任何类型的集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!