I'm using Telerik V2012.1.325.35 and I have a strange problem RowDetailsTemplate. In my project, I have a main RadGridView and all object in his ItemsSource a "IsDeleted" member of type bool. On the "RowLoaded" of my main RadGridview, I do the following to hide all object with the "IsDeleted" == true and everything working fine:
private void gvExams_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
{
ExamForBilling theExam = e.DataElement as ExamForBilling;
if (theExam != null && e.Row != null)
{
e.Row.Visibility = theExam.IsDeleted ? Visibility.Collapsed : Visibility.Visible;
}
}
In my main grid, I have a RowDetailsTemplate that contain another RadGridView with RowLoaded event where I do the samething to hide deleted object. The problem is for every deleted object, the grid display a blank row. Here is the RowLoaded code of my RowDetailsTemplate RadGridView (screenshot attached):
private void RadGridView_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
{
BilledExamsForBilling theExam = e.DataElement as BilledExamsForBilling;
if (theExam != null && e.Row != null)
{
e.Row.Visibility = theExam.IsDeleted ? Visibility.Collapsed : Visibility.Visible;
}
}
17 Answers, 1 is accepted
That would be the expected behavior since you are setting the visibility of the row to collapse. Please take a look at our documentation for further reference.
What you would rather do is to work with the underlying data items and add/ remove them.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

removing object in the underlying data are not a got approach for me :( When I delete an object, I have to mark it as deleted and send it back to my back-end for database IO.
I'm I missing something in your explanations (ie: underlying data!!!) ?!?
Thank's
As mentioned previously, it is not recommended to work with the visual elements of a virtualized control like RadGridView. If you want to remove an item, why not using filtering ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

I added the following piece of code in my XAML under my RadGridView tag:
<telerik:RadGridView.FilterDescriptors>
<telerik:CompositeFilterDescriptor LogicalOperator="And">
<telerik:CompositeFilterDescriptor.FilterDescriptors>
<telerik:FilterDescriptor Member="IsDeleted" Operator="IsNotEqualTo" Value="True"/>
</telerik:CompositeFilterDescriptor.FilterDescriptors>
</telerik:CompositeFilterDescriptor>
</telerik:RadGridView.FilterDescriptors>
and when I change the IsDeleted member of the SelectedItem to TRUE, the item still visible in my grid.
Thank's
I have tested the case and everything works correctly on my side. Could you take a look at the sample attached and let me know whether I am missing something ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

seem's to work but if I want to filter on a field using binding, is it possible? How?
Thank's
Could you clarify a bit on your exact requirements ? Do you want to bind the Value of the filter descriptor ? Does the solution illustrated in this forum thread correspond to your requirements ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

what I'm trying to do know is with a CompositeFilterDescriptor, I want to filter on a property which contain a GUID and the GUID value is not the same on every customer site. That why I cannot, in this situation, using a harcoded value like: <telerik:FilterDescriptor Member="IsDeleted" Operator="IsNotEqualTo" Value="True"/>
Thank's

let me express mysel in a different way :)
Actually in my ItemsSource, I have a property that it's not visible in my grid, it's a GUID property representing the status of the object itself (MarkAsAdded, MarkAsModified or MarkAsDeleted). Each status have a different GUID and thos GUID's are not the same on each site.
In my application, the user can right-click on an item in a grid and change the status of the object to MarkAsDeleted, at this time, I want to hide the object from the grid. After marking for deletion many object in the grid, the user have to click on a button to save his changes, at this moment, I'm looking for each object who was marked for deletion and I send them to my back-end for a database io operation.
Thank's
Based on the scenario that you described, I get the impression that it will be better to remove the items "MarkAsDeleted" for example from the source collection and fill it in another one. Afterwards, when you click the "Save" button, you will know all those that have been removed and will be able to send them back to your database and perform the actions you want.
Am I right or am I missing something from your requirements ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

I can do it as you suggest but I though I could do it the way I did it :(
Thank's

if I try: MyGridView.Items.Remove(MyGridView.SelectedItem)
I fall in the following exception:
System.NotSupportedException: La collection était d'une taille fixe.
à System.Array.System.Collections.IList.Remove(Object value)
à Telerik.Windows.Data.QueryableCollectionView.RemoveItemFromSourceList(Object removedItem) dans c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.Editing.cs:ligne 439
à Telerik.Windows.Data.QueryableCollectionView.Remove(Object item) dans c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.Editing.cs:ligne 421
à Telerik.Windows.Data.DataItemCollection.Remove(Object item) dans c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\DataItemCollection.Editing.cs:ligne 398
à com.christiegrp.Neuron.ClientApplication.VisitBillingDetails.deleteCurrentExam()
à com.christiegrp.Neuron.ClientApplication.VisitBillingDetails.CommandBinding_DoDelete(Object sender, ExecutedRoutedEventArgs e)
Thank's

<telerik:RadGridView.Resources>
<Style TargetType="{x:Type telerik:GridViewRow}">
<Style.Triggers>
<DataTrigger Binding="{Binding ObjectState}" Value="3">
<DataTrigger.Setters>
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger.Setters>
</DataTrigger>
</Style.Triggers>
</Style>
</telerik:RadGridView.Resources>
It is not recommended to work with the visibility of row. Since RadGridView is virtualized, it recycles and reused its visual elements like cells and row. You can take a look at this article for a reference.
What you can try instead is either to filter the collection so that the item you want is not displayed in the grid or remove it from the source.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Working with the visibility of the rows will break the virtualization of the control. This would be true for any other virtualized control as well - DataGrid, RadTreeListView, ListBox, etc.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Visibility" Value="{Binding ObjectState, Converter={StaticResource StateVis}}" />
</Style>
</DataGrid.RowStyle>
The Converter returns "Collapsed" if ObjectState meets some condition. In this case the entire row of the DataGrid collapses. In the Telerik RadGridView, the row is simply hidden and a blank row persists. If I only intend to show a very small amount of data, I don't care about Virtualization, but I do care about the control working with my view model.
Anyhow, this thread is getting more of my attention than intended. I will move along, but I am not thrilled with the proposed solution.
Thanks again.