0

我想刷新我的数据网格,但刷新后,我在组内的排序不再正确......

<XmlDataProvider x:Key="SmsData" XPath="/response/conv/">
</XmlDataProvider>

<local:RowColorConverter x:Key="RowColorConverter" />

<CollectionViewSource x:Key="SmsView"  Source="{StaticResource SmsData}" >
    <CollectionViewSource.SortDescriptions>
        <scm:SortDescription PropertyName="date" Direction="Descending" />
        <scm:SortDescription PropertyName="time" Direction="Descending" />

    </CollectionViewSource.SortDescriptions>

    <CollectionViewSource.GroupDescriptions>
        <dat:PropertyGroupDescription PropertyName="recipient" />

    </CollectionViewSource.GroupDescriptions>
</CollectionViewSource>

我调用了一个按钮,该按钮引用了一种执行刷新的方法:

...

CollectionViewSource cvs = FindResource("SmsView") as  CollectionViewSource;
cvs.View.Refresh();

dataGrid1.Items.Refresh();


xdp = FindResource("SmsData") as XmlDataProvider;
xdp.Document = doc;
4

0 回答 0