Ultragrid は、データが変更されると行のフィルター条件を評価しません。データが変更され、行フィルター条件を行で評価したい場合にこれは役立ちます。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub Button104_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button104.Click ' Following code filters rows and after rows are filtered, it changes the value of a ' row that passed the filter conditions to a value that doesn't pass the filter conditions. ' The row won't get filtered out. It will still be visible. To re-filter it out, you ' have to call RefreshFilters method. ' Filter rows by Country to show only rows with Country equal UK Me.UltraGrid1.Rows.ColumnFilters("Country").FilterConditions.Add(FilterComparisionOperator.Equals, "UK") ' Now get the first visible row and then change the Country of that row to France. Remember ' Country field of all the visible rows after applying the filter above is UK. Dim firstVisibleRow As UltraGridRow = Me.UltraGrid1.Rows.GetRowAtVisibleIndex(0) ' Change the Country of the row to France. Once you click this button, you will see ' that the first row has it's Country equal to France and all the other rows are ' UK. firstVisibleRow.Cells("Country").Value = "France" End Sub Private Sub Button105_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button105.Click ' Call RefreshFilters to reevaluate the filter conditions so if the data has changed ' in rows they get re-filtered. Me.UltraGrid1.DisplayLayout.RefreshFilters() End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button104_Click(object sender, System.EventArgs e) { // Following code filters rows and after rows are filtered, it changes the value of a // row that passed the filter conditions to a value that doesn't pass the filter conditions. // The row won't get filtered out. It will still be visible. To re-filter it out, you // have to call RefreshFilters method. // Filter rows by Country to show only rows with Country equal UK this.ultraGrid1.Rows.ColumnFilters["Country"].FilterConditions.Add( FilterComparisionOperator.Equals, "UK" ); // Now get the first visible row and then change the Country of that row to France. Remember // Country field of all the visible rows after applying the filter above is UK. UltraGridRow firstVisibleRow = this.ultraGrid1.Rows.GetRowAtVisibleIndex( 0 ); // Change the Country of the row to France. Once you click this button, you will see // that the first row has it's Country equal to France and all the other rows are // UK. firstVisibleRow.Cells["Country"].Value = "France"; } private void button105_Click(object sender, System.EventArgs e) { // Call RefreshFilters to reevaluate the filter conditions so if the data has changed // in rows they get re-filtered. this.ultraGrid1.DisplayLayout.RefreshFilters( ); }