【发布时间】:2015-07-07 09:28:35
【问题描述】:
如果我想过滤一个详细信息表(显示在 DataGrid 中),例如使用以下内容:DSHistory.TBL_MATERIAL.DefaultView.RowFilter = string.Format("MAT_NAME LIKE '%{0}%' AND MAT_FK_LFR_ID = {1}",TextBoxSearch.Text, ComboBoxLieferant.SelectedValue); 只有当我在事件中将 DataGrid 的 ItemsSource 显式更改为:dg1.ItemsSource = DSHistory.TBL_MATERIAL; 时才有效,但是那么绑定将不再起作用(在 page_loaded 中我添加了这样的 DataContext:this.DataContext = DSHistory.TBL_LIEFERANTENSTAMM;,当然还绑定了 XAML 中的主表和详细表:<ComboBox Name="ComboBoxLieferant" ItemsSource="{Binding}" DisplayMemberPath="LFR_NAME" IsSynchronizedWithCurrentItem="True" SelectionChanged="ComboBoxLieferant_SelectionChanged" />
和 <DataGrid Name="dg1" ItemsSource="{Binding Path=FK_TBL_MATERIAL_TBL_LIEFERANTENSTAMM}" IsSynchronizedWithCurrentItem="True">
有没有办法在不“破坏”绑定的情况下进行这样的过滤?
感谢您的帮助!
【问题讨论】:
标签: wpf binding master-detail rowfilter