I have a XamDataGrid with record filtering allowed. The first field is a "Selected" checkbox and the rest are just the data from the objects I display in the grid. In terms of code it looks something like this:
<igWPF:XamDataGrid x:Name="xamDataGrid"
DataSource="{Binding SomeDataSourceInTheViewModels}">
<!-- XamDataGrid Settings -->
<igWPF:XamDataGrid.FieldLayoutSettings>
<igWPF:FieldLayoutSettings FilterAction="Hide"
FilterUIType="LabelIcons"/>
</igWPF:XamDataGrid.FieldLayoutSettings>
<igWPF:XamDataGrid.FieldSettings>
<igWPF:FieldSettings ...
AllowRecordFiltering="True"
FilterOperatorDefaultValue="Equals"
FilterLabelIconDropDownType="MultiSelectExcelStyle"
.../>
</igWPF:XamDataGrid.FieldSettings>
<!-- XamDataGrid Field layout -->
<igWPF:XamDataGrid.FieldLayouts>
<igWPF:FieldLayout>
<igWPF:Field Label="Selected" Name="Selected" Width="Auto">
<!-- Select/Unselect all button -->
<igWPF:Field.Settings>
<igWPF:FieldSettings AllowEdit="True">
<igWPF:FieldSettings.LabelPresenterStyle>
<Style TargetType="{x:Type igWPF:LabelPresenter}" BasedOn="{StaticResource {x:Type igWPF:LabelPresenter}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igWPF:LabelPresenter}">
<!-- The Select all checkbox -->
<CheckBox />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</igWPF:FieldSettings.LabelPresenterStyle>
</igWPF:FieldSettings>
</igWPF:Field.Settings>
</igWPF:Field>
<!-- The rest of the fields -->
<igWPF:Field Label="SomeIntValue" Name="SomeIntValue" Width="Auto"/>
<igWPF:Field Label="SomeBoolValue" Name="SomeBoolValue" Width="Auto" />
<igWPF:Field Label="SomeStringValue" Name="SomeStringValue" Width="Auto" />
</igWPF:FieldLayout>
</igWPF:XamDataGrid.FieldLayouts>
</igWPF:XamDataGrid>
My end goal is to have a checkbox on the top of the datagrid above the Selected
column where I can click and select all non-filtered rows. I'm open to new ideas on how to implement this, but my question is: how can I loop through all the non-filtered rows in code-behind or in ViewModel?
I know there is an "IsFilteredOut" property somewhere but can't find it in xamDataGrid
The GetFilteredOutDataRecords() method of the RecordManager returns all data records that do not pass record filter conditions:
foreach(var rec in xamDataGrid.RecordManager.GetFilteredOutDataRecords())
{
// TODO: ...
}
Hope that helps.