I would like to hide some records in a XamDataGrid. I use a setter to do so as shown below.
<igWPF:XamDataGrid.Resources>
<Style TargetType="{x:Type igWPF:CellValuePresenter}">
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=DataContext.DataItem.Description}"/> <Setter Property="Visibility" Value="{Binding RelativeSource={RelativeSource Self}, Path=DataContext.DataItem.Test, Converter={StaticResource booleanToVisibilityConverter}}"/>
</Style>
</igWPF:XamDataGrid.Resources>
However, the record is hidden but a blank placeholder is still there even though the converter returns a "Hidden" or "Collapsed" value. Is there a way to hide records with another property?
Hello Jean-Marc,
Thank you for contacting Infragistics. The behavior is to be expected since the DataRecordPresenter & DataRecordCellArea ('placeholder" element) will remain on screen because these are parent elements of the XamDataGrid.
I recommend hiding the DataRecordCellArea.
<Style TargetType="{x:Type igWPF:DataRecordCellArea}"> <Setter Property="Visibility" Value="Hidden"/> </Style>
I recommend reviewing the topic for styling points in the XamDataGrid.
Note, the preferred option in this scenario is to use the built-in Record Filtering functionality instead of manually hiding records.
Let me know if you have any questions.
This looks good to me and works fine except that I need to add a field for the filter to work.
<igWPF:RecordFilter FieldName="Quality"> This binds to the column name Quality
I would prefer to bind directly to the property of my object as:
<igWPF:RecordFilter FieldName="{Binding Quality}"> This binds to my object Quality property
Thanks,
JMD
Thank you for following up. Yes a minimum of one field needs to render to perform any type of filtering or show any cells or rows. However, I am a little confused. If Quality is a property on in data item then you don't need to bind. Are you trying to avoid entering a string?
Note, the FieldName property is a string and not a dependency property which specifies the field name whose cell data will be matched against filter conditions of this RecordFilter to determine if the a particular DataRecord should be filtered out.
Note that the FieldName and the Field properties will be synchronized. When FieldName is set, Field property will be updated to reflect the matching Field object. If no Field with that name exists then the Field property will return null. Likewise when you set the Field property, the FieldName will be updated to reflect the name of the set Field. If Field is set to null, then FieldName will be set to null as well.