I have a WPF GridView
, and part of the data needs to be shown in the Totals (both Footer and Group totals), but not in the actual data records.
I thought it would be easy to write a trigger and hide the row based on the row's data, however it turns out that Telerik's GridView
uses an unusual panel for virtualization, so although the specified rows get hidden, a blank white space is left where it should go.
Here's my current style. It does hide the row, but it is the equivalent to making the visibility Hidden
instead of Collapsed
(hides the item, but leaves white space where it is)
<Style TargetType="{x:Type telerik:GridViewGroupRow}">
<Setter Property="Visibility" Value="Visible" />
<Style.Triggers>
<DataTrigger Binding="{Binding Group.Key, RelativeSource={RelativeSource Self}}" Value="SomeValue">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
I have tried setting the ItemTemplate to null, removing the Item from the Telerik's GridViewVirtualizingPanel, and adjusting the Visibility, but none of these options seem to work.
Does anyone know of a way I could accomplish this? I either want to hide (and collapse) the rows based on a trigger, or find a way to get the query of the current Grouped Expression so I can query a 2nd collection and display the results in the Group Total. I have no problem with using Code-Behind or something hackish to accomplish this.
Edit
As an interesting side note, I can set the height to 1, but not 0. Even 1 is too much though, since I can be hiding thousands of records and this leaves a huge white area on the screen.
I posted a question on Telerik's forums as well, and apparently this is not possible. My options are to either filter the result set, or set the Height of the rows to 1.
If I filter the result set, my Aggregates are incorrect. If I set the row height to 1, I still get large areas of whitespace if there are a lot of records hidden (which there are).
My end solution was to set the row height of grouped row to 1, and just show non-grouped items. This means all items show if the data is ungrouped, but when grouped there is a 1px white line which is barely noticeable running through the grid where the hidden items are.