Hello,
I am trying to make an inventive UI, by allowing the User to choose what they see, but I am having an issue with a few issues.
First I collapse the rows in the grid based on a value in on the object that is bound to row. This is done via style, here is the code:
<igDP:XamDataGrid.Resources> <rent:BindingProxy x:Key="proxy" Data="{Binding}" /> <Style TargetType="{x:Type igDP:DataRecordCellArea}"> <Setter Property="BackgroundAlternate" Value="LightGoldenrodYellow"/> <Setter Property="BorderBrush" Value="Black" /> <Setter Property="BorderThickness" Value="0,0,1,1" /> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.ApplyAdj}" Value="False"> <Setter Property="Visibility" Value="Collapsed" /> </DataTrigger> </Style.Triggers> </Style> </igDP:XamDataGrid.Resources>
The problem seems that even though I am collapsing the rows, there appears to be a margin.
I have Attached an image to show what i am talking about.
Another issue is that it appears that I am unable to hide all rows in the grid. Even though the objects are all updated correctly, the grid will not hide the last row in the collection. Is this by design??
Thank you,Bryan
Hello Bryan,
Thank you for your post.
I would recommend against styling the DataRecordCellArea for this, as this is a lower-level element, and I believe that is likely why you are seeing some space left over. Instead, I would recommend setting your DataTrigger on a Style for DataRecordPresenter, and instead of setting the Visibility to “Collapsed,” set the Height property to “0.” The same binding will work, as the DataRecordCellArea and the DataRecordPresenter have the same data context. The DataRecordPresenter just houses the DataRecordCellArea, and is likely what is making up this extra space that you are seeing.
I also must be curious that since you are looking to control the visibility of the rows in the XamDataGrid, have you considered using the filtering capabilities of the grid, as this will hide the rows for you without the need for extra styling?
I hope this helps. Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer