Hello,
I am having an issue with filters in nested grid. Parent Row and child rows have same structure (I have used the code snippet from forum to display just one header at the top and child columns are sized properly to align with parent haders). I show the filters row at the top.
Here is the scenario,
Let us say we have following grid structure
Id, Name, description (for parent row)
and same ID, Name, Description (for child row)
Let us say I put a filter in Name (starts with A) what happens is any parent row that matches the criteria gets filtered. it doesn't apply filter on child rows.
What i need is if a child row satisfies the condition then it should display along with parent row (even if the parent row doesn't satisfy the condition).
How can I show the filter row at top (provided by the grid) but apply the filter programatically. This way I can handle the filtering of the rows based on both parent and child.
RegardsVish
Hello Vish,
I have created a sample project for you where I modified your code, so now I don’t set the DataRecordPresenter’s Visibility, but its Height.
Hope this helps you.
I tried creating a style for DataRecordPresenter but it doesn't work. Can you please give me a small example to make rows visible/collapsed using DataRecordPresenter style and using some converter or using some datatrigger/trigger.
Thanks for your help.
Hello again,
I can suggest you create a Style for the DataRecordPresenter instead of DataRecordCellArea.
Thanks for a quick reply. I have kind of figured out what I need to achieve. But there is an issue. I am unable to collapse the rows. The row cells are collapsed but still the space for the row and the row marker a small triangle is still visible.
This is what I am doing. I have set a DataTrigger on DataRecordCellArea.
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.IsFilteredOut}" Value="True">
<Setter Property="Visibility" Value="{Binding RelativeSource={RelativeSource Self}, Path=Record, Converter={StaticResource visibilityConverter}}" />
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.IsFilteredOut}" Value="False">
public
object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null)
return Binding.DoNothing;
DataRecord record = value as DataRecord;
if(record == null)
if (record.HasChildren)
foreach (var expandableChildRecord in record.ChildRecords)
if(expandableChildRecord.HasChildren)
foreach(var childRecord in expandableChildRecord.ChildRecords)
var childDataRecord = childRecord as DataRecord;
if(childDataRecord != null)
if (!childDataRecord.IsFilteredOut.GetValueOrDefault(false))
return Visibility.Visible;
}
//record.Visibility = Visibility.Collapsed;
return Visibility.Collapsed;
Please Look at the image, When this code is applied the cells are collapsed but empty row is still there. The row area in Red Rectangle is the rows that have to be set as collapsed. I am not sure what I am doing wrong. I think I am almost there but can't figure out how to hide a row.
The behavior you have is expected. Here you can read about the “None” value of the FilterAction:
http://help.infragistics.com/NetAdvantage/WPF/2011.2/CLR4.0/?page=InfragisticsWPF4.DataPresenter.v11.2~Infragistics.Windows.DataPresenter.RecordFilterAction.html
Also I can say that the Records are enabled and you can edit them if it is allowed.