This is a migrated thread and some comments may be shown as answers.

Grouping Exception

2 Answers 101 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Adam Marshall
Top achievements
Rank 1
Adam Marshall asked on 27 Jan 2010, 10:27 PM

Whenever I attempt to remove a group from the grid grouping area, either by dragging or clicking the 'close' button, an exception occurs.

I am using Q3 SP2 and VS2010 project (.NET4)
I have tried the same code in a .NET 3.5 project and the exception does not occur.

InvalidCastException:
Unable to cast object of type 'MS.Internal.NamedObject' to type 'Telerik.Windows.Data.GroupDescriptor'.

   at Telerik.Windows.Data.GroupDescriptor.Equals(Object obj) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Data\Grouping\GroupDescriptor.cs:line 191
   at System.Object.Equals(Object objA, Object objB)
   at System.Windows.Data.BindingExpression.OnDataContextChanged(DependencyObject contextElement)
   at System.Windows.Data.BindingExpression.HandlePropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
   at System.Windows.Data.BindingExpressionBase.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
   at System.Windows.Data.BindingExpression.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
   at System.Windows.DependentList.InvalidateDependents(DependencyObject source, DependencyPropertyChangedEventArgs sourceArgs)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.TreeWalkHelper.OnInheritablePropertyChanged(DependencyObject d, InheritablePropertyChangeInfo info)
   at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d)
   at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe)
   at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d)
   at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
   at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
   at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
   at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d)
   at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe)
   at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d)
   at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
   at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
   at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
   at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d)
   at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe)
   at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d)
   at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
   at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
   at System.Windows.DescendentsWalker`1.StartWalk(DependencyObject startNode, Boolean skipStartNode)
   at System.Windows.TreeWalkHelper.InvalidateOnInheritablePropertyChange(FrameworkElement fe, FrameworkContentElement fce, InheritablePropertyChangeInfo info, Boolean skipStartNode)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at System.Windows.Controls.ItemContainerGenerator.UnlinkContainerFromItem(DependencyObject container, Object item)
   at System.Windows.Controls.ItemContainerGenerator.OnItemRemoved(Object item, Int32 itemIndex)
   at System.Windows.Controls.ItemContainerGenerator.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   at System.Windows.Controls.ItemContainerGenerator.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
   at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
   at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
   at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.Controls.ItemCollection.System.Windows.IWeakEventListener.ReceiveWeakEvent(Type managerType, Object sender, EventArgs e)
   at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
   at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
   at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.Data.ListCollectionView.ProcessCollectionChangedWithAdjustedIndex(NotifyCollectionChangedEventArgs args, Int32 adjustedOldIndex, Int32 adjustedNewIndex)
   at System.Windows.Data.ListCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.Data.CollectionView.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\RadObservableCollection.cs:line 141
   at System.Collections.ObjectModel.ObservableCollection`1.RemoveItem(Int32 index)
   at Telerik.Windows.Data.RadObservableCollection`1.RemoveItem(Int32 index) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\RadObservableCollection.cs:line 212
   at Telerik.Windows.Data.ObservableItemCollection`1.RemoveItem(Int32 index) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\ObservableItemCollection.cs:line 68
   at System.Collections.ObjectModel.Collection`1.Remove(T item)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.Ungroup(String member) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3302
   at Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass2a.<GroupingRequested>b__29() in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3196
   at Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(FrameworkElement frameworkElement, Action action) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\CursorManager.cs:line 16
   at Telerik.Windows.Controls.GridView.GridViewDataControl.GroupingRequested(Object origin, GroupingRequestedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3177


XAML

<Window  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    x:Class="WpfApplication1.MainWindow" 
    x:Name="Window" 
    Title="MainWindow" 
    Width="640" Height="480" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"   > 
 
    <Grid x:Name="LayoutRoot">  
        <telerik:RadGridView x:Name="grid">  </telerik:RadGridView> 
    </Grid> 
</Window> 

I used the code behind file for simplicity of testing:
using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Text;  
using System.Windows;  
using System.Windows.Controls;  
using System.Windows.Data;  
using System.Windows.Documents;  
using System.Windows.Input;  
using System.Windows.Media;  
using System.Windows.Media.Imaging;  
using System.Windows.Shapes;  
 
namespace WpfApplication1  
{  
    /// <summary>  
    /// Interaction logic for MainWindow.xaml  
    /// </summary>  
    public partial class MainWindow : Window  
    {  
        public List<DOStaff> col = new List<DOStaff>();  
          
        public MainWindow()  
        {  
              
            this.InitializeComponent();  
 
            // Insert code required on object creation below this point.  
                  
            DOStaff tempStaff = new DOStaff();  
            tempStaff.FirstName = "staf12399";  
              
            col.Add(tempStaff);   
          
            DOStaff tempStaff1 = new DOStaff();  
            tempStaff1.FirstName = "staf12399";  
              
            col.Add(tempStaff1);      
              
            grid.ItemsSource=col;  
              
        }  
    }  
      
    public class DOStaff  
    {  
        public virtual string FirstName { getset;}  
      
    }  
      

2 Answers, 1 is accepted

Sort by
0
Michael Fooks
Top achievements
Rank 1
answered on 28 Jan 2010, 12:42 AM
0
Pavel Pavlov
Telerik team
answered on 28 Jan 2010, 08:33 AM
Hello Bronwen Zande,

Currently we are working to resolve this problem. It is .NET 4 specific . the Public Issue Tracking ID of the bug is 729.
Please excuse us for the inconvenience caused.

All the best,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Adam Marshall
Top achievements
Rank 1
Answers by
Michael Fooks
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Share this question
or