hello,
i would like to be able to hide/show rows based on underlying data property.
Let's say i bind the grid to Customer.IsVisibible., and i bind the grid to ObservableCollection<Customer>..
how can i bind row visibility to Customer.IsVisible?
thanks.
Hi Squarewave24,
You can use a style targeting the DataRecordPresenter to do this. Using a DataTrigger you can watch for the IsVisible property in your data item and when it is False you can set the height of the DataRecordPresenter to zero. The style looks like this:
<Style x:Key="dataRecordPresenter" TargetType="{x:Type igDP:DataRecordPresenter}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=DataItem.IsVisible}" Value="False"> <Setter Property="Height" Value="0"/> </DataTrigger> </Style.Triggers></Style>
Using the style works as follows:
<igDP:XamDataGrid> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings DataRecordPresenterStyle="{StaticResource dataRecordPresenter}"/> </igDP:XamDataGrid.FieldLayoutSettings></igDP:XamDataGrid>
Let me know if you have any questions.
Hi
Thank you for your post. I got my answer for hiding record.
But i got issue in scrolling.When i scroll it consider all collection having height 0. So scroll viewer is not working proper for me.
Here i attached sample application. i have 1000 records in collection but display only some record. So when scroll it shows in scroll bar tooltip.
Thank you
Adit
thanks, i'll try this
Let me know if you have any further questions on this matter.