I tried following approaches:
1. Handle RowLoaded event and change e.Row.Visibility
Row is disappear, but empty space is still visible
2. Copy and modify template for GridViewRow. I created converter for Visibility property.
2.1. If I use this converter for Visibility property to Root Border or to SelectiveScrollingGrid. Row is Row is disappear, but empty space is still visible
2.2 If I use this converter for DataCellsPresenter. Only selection border is visible and row has very small height, but doesn't disappear
Is it possible to solve me issue?
5 Answers, 1 is accepted
This is the expected behavior. Any attempt to play with the Visibility property of a GridViewRow will result in such a behavior. To get the one you need, you may filter the items rather than set their visibility. Pplease refer to the following article.
Vanya Pavlova
the Telerik team
- My filtering condition is related to private property (as a part of explicit interface implementation) of Data item
- This property need to be invisible to user. As a result I can't afford to show it in GridView header
May you share with us the source code you are currently using? If you need to filter these values, you have to mark this property as public. In case this property should not be visible to the end-users, just set the IsVisible property of its corresponding GridViewDataColumn to False:
<telerik:RadGridView x:Name="gridView1" AutoGenerateColumns="False"> <telerik:RadGridView.FilterDescriptors> <telerik:FilterDescriptor Member="Age" Operator="IsEqualTo" Value="32" IsCaseSensitive="False"/> </telerik:RadGridView.FilterDescriptors> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn Header="FirstName" DataMemberBinding="{Binding FirstName}"/> <telerik:GridViewDataColumn Header="LastName" DataMemberBinding="{Binding LastName}"/> <telerik:GridViewDataColumn Header="Married" DataMemberBinding="{Binding Married}"/> <telerik:GridViewDataColumn Header="Age" DataMemberBinding="{Binding Age}" IsVisible="False"/> </telerik:RadGridView.Columns> </telerik:RadGridView>I will be waiting for your response.
Regards,
Vanya Pavlova
the Telerik team
var editableObject = valueasIEditableObjectInfo;if(editableObject !=null){returneditableObject.IsAdding ? Visibility.Collapsed : Visibility.Visible;}returnVisibility.Visible;
Data Item is implementing IEditableObjectInfo explicitly. I can't change it.
Unfortunately, Silverlight doesn't support obtaining private property values via reflection. Moreover changing GridViewRow's template may lead to critical visual issues in other scenarios of your application. The only solution that comes to my mind is modifying your ViewModel by adding a public property that could act as a mark to the filtering and doesn't interfere with your interface definition. Of course, it doesn't need to be shown in a column of your RadGridView.
Please, do not hesitate to contact us, if you have any further questions.
Ivan Ivanov
the Telerik team