如何观察相关的ViewSource?

时间:2012-02-24 11:42:05

标签: c# .net wpf observablecollection collectionviewsource

在WPF XAML中我有

<CollectionViewSource
    x:Key="aViewSource"
    d:DesignSource="{d:DesignInstance my1:TableA, CreateList=True}" />
<CollectionViewSource
    x:Key="anotherViewSource"
    Source="{Binding Path=ANOTHER, Source={StaticResource aViewSource}}" />

在xaml.cs中我有

var aViewSource = (CollectionViewSource)this.FindResource("aViewSource");
var tableA = new ObservableCollection<TableA>(
    this.entities.TableA
        .Where(predicate)
        .Take(10)
        .ToList());
tableA.CollectionChanged += this.NotifyCollectionChangedEventHandler;
fibrasViewSource.Source = tableA;

如何观察anotherViewSource

1 个答案:

答案 0 :(得分:0)

我完全放弃了ViewSource,因为我没有看到使用它的优势。