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

Error on ItemsSource

2 Answers 35 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marc Roussel
Top achievements
Rank 2
Marc Roussel asked on 18 Jan 2011, 08:31 PM
Hi,

All I do is setting the ItemsSource of my grid to my collection.  Can you give me a hint on what is this ?
I don't know what is CheckInternalViewIsNotUsed.  I need to understand as I do this for many grids with many collections that works 100% all the time.  My collection is as normal as any other one there's nothing wrong in it. as I did try to set it to a simple ListBox and I did not have any trouble.  I don't know what to look for with that.

I never had to empty a collection before setting ItemsSource.  I just hope you'll not ask for a repro as this is way to huge to send you it's a complete production software and taking part of it will not make you reproduce it so if you may give me any hints about what you see below would be greatful !

 

Items collection must be empty before using ItemsSource.
  
   à Telerik.Windows.Data.DataItemCollection.CheckInternalViewIsNotUsed()
   à Telerik.Windows.Data.DataItemCollection.SetItemsSource(IEnumerable source)
   à Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass48.<Bind>b__47()
   à Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(FrameworkElement frameworkElement, Action action)
   à Telerik.Windows.Controls.GridView.GridViewDataControl.Bind(Object newValue)
   à Telerik.Windows.Controls.GridView.GridViewDataControl.OnItemsSourceChanged(Object oldValue, Object newValue)
   à Telerik.Windows.Controls.DataControl.OnItemsSourcePropertyChanged(DependencyObject origin, DependencyPropertyChangedEventArgs args)
   à Telerik.Windows.PropertyMetadata.<>c__DisplayClass1.<Create>b__0(DependencyObject d, DependencyPropertyChangedEventArgs e)
   à System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
   à System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
   à System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
   à Foo.MainPage.SetComponentsGrid()

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 19 Jan 2011, 08:07 AM
Hi,

 Can you verify if you have something in grid Items collection before assigning ItemsSource?

Greetings,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Marc Roussel
Top achievements
Rank 2
answered on 19 Jan 2011, 01:57 PM
Yes I added a if statement to check if Items have something and it has indeed something but you know this is normal as I reassign the grid when  back in the WCF call back and this always worked and never had this before.  The key thing here is that I have a WCF call back which I populate a private collection _MyCollection that I just assign to the grid after like MyGrid.ItemsSource = _MyCollection;

And each time I come back in this WCF call back it's doing the same thing,  Getting the _MyCollection = e.Result; and again MyGrid.ItemsSource = _MyCollection

If I clear the Items before setting the ItemsSource, I have other kind of error which I don't remember.  Something like I can't right now because is is in used don't remember exactly the other error.

I'm not sure what I am doing wrong. so I will play around and see if this happen again.
Tags
GridView
Asked by
Marc Roussel
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Marc Roussel
Top achievements
Rank 2
Share this question
or