Created
March 3, 2017 06:07
-
-
Save hilapon/3d0de8c9e00e65756945aa8b7f0068a8 to your computer and use it in GitHub Desktop.
レコードのフィルタリングのサンプル(其の弐)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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