在多个组合框中使用DomainDataSource [英] use a DomainDataSource in multiple comboboxes

查看:75
本文介绍了在多个组合框中使用DomainDataSource的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这更多是关于最佳方式的问题.

我在应用程序中有四个组合框,它们绑定到同一查找表.查找表中有900条记录.三个组合框是我的雇员表中不同字段的查找.四个组合框的最后一个是针对employee表的过滤器.可以用与其他三个组合框不同的方式来过滤最后一个组合框.该列表也可以与其他三个列表相同.

什么?你可能会问.将查找表视为商店列表.因此,一个领域是您购买衣服的地方,一个领域是鞋子和电器的领域.因此,存储列表始终是相同的,但是三个数据字段可以相同或不同.

该应用程序工作正常.目前,对于应用程序中的每个组合框,我都有四个不同的类和四个不同的域数据源.

我敢肯定有比四次加载相同数据更好的方法.有人可以建议克隆或复制数据源的最佳方法吗?我什至需要四个数据源吗?

另一个重要的事实.三个数据组合中只有一个将始终具有数据.大多数情况下,只有当字段中有数据或drop事件时,才能加载其他两个.

Larry Freedman

This is more of a what''s the best way question.

I have four combo boxes in an application that are bound to the same lookup table. There are 900 records in the lookup table. Three of the comboboxes are lookups for different fields in my employee table. The last of the four comboboxes is a filter for the employee table. This last combobox can be filtered in a different way from the other three. The list can also be the same as the other three.

What? You may ask. Think of the look up table as a list of stores. So one field is where you buy your clothes, one field is for your shoes and one for your appliances. So the list of stores is always the same but the three data fields can be the same or different.

The application works fine. Currently I have four different classes and four different domain data sources for each of the combo boxes in the application.

I am sure there is a better way than loading the same data four times. Can someone suggest the optimal way to clone or copy the data sources? Do I even need four data sources?

One other important fact. Only one of the three data combo''s will always have data. Most of the time the other two could be loaded only if there is data in the field or the dropped event.

Larry Freedman

推荐答案

如果您使用的是xaml中定义的数据源,也许合适的数据层会更干净?您可以使用clone方法复制数据源,但是如果将四个控件链接到同一数据源,则in通知它们将同步其选择.在那方面,还不确定Silverlight.
If you''re using data sources defined in your xaml, perhaps a proper data layer would be cleaner ? You can use the clone method to copy a data source, but if you link four controls to the same datasource, in informs they would synch their selection. Not sure about silverlight, in that regard.


到目前为止,我还无法找到一种在WCF中克隆数据源的方法.也许查询可以通过某种方式返回列表,而我可以克隆该列表,但这就是为什么我要寻求一些答案的原因.

感谢您的回复.

拉里
As of yet I have not been able to find a way to clone the data source in WCF. Maybe there is some way the query could return a list and I could clone the list but that is why I am reaching out for some answers.


Thanks for the response.

Larry


这篇关于在多个组合框中使用DomainDataSource的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆