Skip to content

Instantly share code, notes, and snippets.

@hilapon
Created March 3, 2017 06:07
Show Gist options
  • Save hilapon/3d0de8c9e00e65756945aa8b7f0068a8 to your computer and use it in GitHub Desktop.
Save hilapon/3d0de8c9e00e65756945aa8b7f0068a8 to your computer and use it in GitHub Desktop.
レコードのフィルタリングのサンプル(其の弐)
using System.Windows.Threading;
using Infragistics.Windows.DataPresenter;
using Infragistics.Windows.DataPresenter.Events;
/// <summary>
/// レコードのフィルタリング完了時のイベント
/// </summary>
private void XamDataGrid_RecordFilterChanged(object sender, RecordFilterChangedEventArgs e) {
// 当方のシステムでは ContextIdle でうまくいった。
Application.Current.Dispatcher.Invoke(() => { }, DispatcherPriority.ContextIdle);
var presenter = sender as DataPresenterBase;
if (presenter != null) {
var records = presenter.Records.Where(record => {
if (record.IsDataRecord) {
var dr = ((DataRecord)record);
return !dr.IsFilteredOut.GetValueOrDefault(false);
}
return false;
});
// 表示されてるレコード数
Console.WriteLine(records.Count().ToString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment