如何在Xamdatagrid中的所有未过滤行循环



我有一个带有记录过滤的Xamdatagrid。第一个字段是"选择"复选框,其余的只是我在网格中显示的对象的数据。在代码方面,它看起来像这样:

<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>

我的最终目标是在Selected列上方的DataGrid的顶部有一个复选框,我可以单击并选择所有未过滤的行。我对如何实现此目标有新的想法,但是我的问题是:我如何循环浏览代码范围或ViewModel中的所有未过滤行?

我知道某处有一个" iSfiltered"属性,但在xamDataGrid

中找不到它

getFilteredOutDataRecords() recordManager 条件:

foreach(var rec in xamDataGrid.RecordManager.GetFilteredOutDataRecords())
{
  // TODO: ...
}

希望会有所帮助。

最新更新