WinUI コントロール
フィルタ
コントロール > FlexGrid > フィルタ

Grid filtering lets you narrow down display records according to a specified condition applied on a column. It is especially useful in case of large data sets as it lets you easily analyze data by displaying a specific type of records only.

FlexGrid provides the GridFilterRow class that represents a row whose cells are text boxes used to filter the corresponding column. This class is used to show a filter row at row 0 index to filter data in grid rows. The GridFilterRow class provides the AutoComplete property, which when set to true, sets the typed text to auto-complete based on the data in the grid.

var data = Customer.GetCustomerList(100);
flexGrid1.ItemsSource = data;             
<Grid>
   <c1:FlexGrid x:Name="flexGrid1" IsReadOnly="True" HeadersVisibility="All" FrozenRows="1" Grid.Row="1">
         <c1:FlexGrid.Rows>
             <c1:GridFilterRow AutoComplete="True"/>
         </c1:FlexGrid.Rows>
   </c1:FlexGrid>
</Grid>              

Change Filter Language

By default, FlexGrid localizes the column filter editor to use language specified by the CurrentUICulture setting. However, you can use the Language property to override the default and specify the language to be used when grid displays the column filter editor.

Use the below code to change the display language of filter in the WinUI FlexGrid.

//文化と言語を日本語に設定
var culture = new CultureInfo("ja-JP");
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
flexGrid1.Language = "ja-JP";
<Grid>
<c1:FlexGrid x:Name="flexGrid1"  AutoGenerateColumns="False">
<c1:FlexGrid.Columns>
<c1:GridColumn Binding="Id" IsReadOnly="true" Width="*"/>
<c1:GridColumn Binding="FirstName" Width="*"/>
<c1:GridColumn Binding="LastName" Width="*"/>
<c1:GridColumn Binding="Address" MinWidth="200" Width="*"/>
<c1:GridColumn Binding="City" MinWidth="200" Width="*"/>
<c1:GridColumn Binding="CountryId" Header="Country" MinWidth="150" Width="*"/>
<c1:GridColumn Binding="Email" MinWidth="200" Width="*"/>
<c1:GridColumn Binding="PostalCode" MinWidth="110" Width="*" />
<c1:GridColumn Binding="Active" MinWidth="110" Width="*"/>
<c1:GridDateTimeColumn Binding="LastOrderDate" Mode="Date" MinWidth="110" Width="*" HorizontalAlignment="Right" HeaderHorizontalAlignment="Right"/>
<c1:GridDateTimeColumn Binding="LastOrderDate" Mode="Time" Header="Last Order Time" MinWidth="110" Width="*" HorizontalAlignment="Right" HeaderHorizontalAlignment="Right"/>
<c1:GridColumn Binding="OrderTotal" Format="C" MinWidth="110" Width="*" HorizontalAlignment="Right" HeaderHorizontalAlignment="Right"/>
</c1:FlexGrid.Columns>
</c1:FlexGrid>
</Grid>