问题描述
嘿伙计们,
我在这里有点新意,希望我的问题不是很愚蠢。
我有一个BOTableRow,其属性Time和Value实现了INotifyPropertyChanged。然后我使用TableRows的Collection(实现INotifyCollectionChanged-Events)来填充一些DataGridViews,这些DataGridViews是用虚拟模式设置的,带有Data。
我的问题是:所有DataGridViews的Time值应该相同。另一个属性特定于它自己的DataGridView。因此,当我在一个视图中操作列时间的第1行时,所有视图都应使用新值更新其第一行。
现在我通过使用自实现类型ObservableDictionary< t>来解决这个问题。对于我的BO上的Value属性。因此,每个DataGridView都可以使用键查找它自己的Value值,但所有值都会查看Time的相同值。 (他们都被绑定到相同的BO列表。)
有没有更简单的方法来解决这个问题?干涉这些字典使得事情变得比我认为的要复杂得多。
Hey guys,
I am kinda new here, hope my question isn't plain stupid.
I have a BO "TableRow" with properties Time and Value implementing INotifyPropertyChanged. Then I use a Collection (which implements INotifyCollectionChanged-Events) of TableRows to fill some DataGridViews, which are setup with virtual mode, with Data.
My problem is: The value of Time should be the same for all DataGridViews. The other property is specific to it's own DataGridView. So when i manipulate Row 1 of Column "Time" in one view, all views should update their first row with the new value.
Right now I am solving this by using a self implemented type ObservableDictionary<t> for the Value property on my BO. So each DataGridView can look up it's own value of Value with a key, but all will look at the same value for Time. (They are all bound to the same List of BOs.)
Is there an easier way to solve this? Meddling around with those Dictionaries makes things more complicated than I feel they should be.
推荐答案
这篇关于BO之间共享财产?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!