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

The new DomainCollectionView and RadGridView

8 Answers 201 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tomas
Top achievements
Rank 1
Tomas asked on 03 Dec 2010, 02:21 PM
Hi,

The WCF RIA Services team released a new toolkit on 2 December, which included a MVVM friendly collection that supports server side paging, filtering and grouping. With the sdk datagrid it works as intended but with RadGridView it crashes with the following stack trace:

at System.Windows.Data.CollectionView.VerifyRefreshNotDeferred()
at System.Windows.Data.CollectionView.get_CurrentItem()
at Microsoft.Windows.Data.DomainServices.CollectionViewWrapper.get_CurrentItem()
at Telerik.Windows.Data.DataItemCollection.UpdateCurrentItemFromSourceCollection()
at Telerik.Windows.Data.DataItemCollection.HandleCurrentItemChangeOfSourceCollectionView(Object sender, EventArgs args)
at Telerik.Windows.Data.DataItemCollection.Telerik.Windows.Data.IWeakEventListener<System.EventArgs>.ReceiveWeakEvent(Object sender, EventArgs args)
at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args)
at Microsoft.Windows.Data.DomainServices.CollectionViewWrapper.OnPageChanged(EventArgs e)
at Microsoft.Windows.Data.DomainServices.CollectionViewWrapper.OnPagedCollectionViewPageChanged(Object sender, EventArgs e)
at Microsoft.Windows.Data.DomainServices.PagedCollectionViewBase.OnPageChanged(EventArgs e)
at Microsoft.Windows.Data.DomainServices.PagedCollectionViewBase.EndMoveToPage(Int32 pageIndex)
at Microsoft.Windows.Data.DomainServices.DomainCollectionView.DomainPagedCollectionView.CompleteMoveToPage(Int32 pageIndex)
at Microsoft.Windows.Data.DomainServices.DomainCollectionView.SyncToCurrentValues()
at Microsoft.Windows.Data.DomainServices.DomainCollectionView.OnLoadCompleted(Object sender, AsyncCompletedEventArgs e)
at Microsoft.Windows.Data.DomainServices.CollectionViewLoader.OnLoadCompleted(AsyncCompletedEventArgs e)
at Microsoft.Windows.Data.DomainServices.DomainCollectionViewLoader.OnLoadCompleted(Object sender, EventArgs e)
at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Object result)
at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(DomainClientResult result)
at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )

A example solution can be found in the following blogpost: http://blogs.msdn.com/b/kylemc/archive/2010/12/02/introducing-an-mvvm-friendly-domaindatasource-the-domaincollectionview.aspx
Just switch the sdk datagrid to a RadGridView and running the application causes it to instantly crashes.

Tomas

8 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 03 Dec 2010, 03:10 PM
Hello Tomas,

Have in mind that this toolkit is still in CTP. Nevertheless, we will investigate this issue immediately. Thank you for reporting it. We will let you know what is going on when we find out.

At first glance it seems that MS have made a breaking change and they are raising the PageChanged event while their collection is still inside the DeferRefresh. When the page is changed, we want to sync the current item and we ask the collection to give it to us but it slams us because it is still inside a DeferRefresh. Very weird.

We will investigate how this can be resolved.

Regards,
Ross
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Accepted
Kyle
Top achievements
Rank 1
answered on 07 Dec 2010, 07:47 PM
This is probably an error in the DomainCollectionView in the December 2010 Toolkit. It seems like a reasonable expectation to be able to access the CurrentItem when a PageChanged event is raised. Until the next toolkit release, this workaround will allow you to use the DCV with the Telerik RadGridView. Just use the DCVW in place of the DCV.

private class DomainCollectionViewWorkaround<TItem> : DomainCollectionView<TItem>
{
    private bool _suppressDefer;
    public DomainCollectionViewWorkaround(CollectionViewLoader collectionViewLoader, IEnumerable<TItem> source)
        : base(collectionViewLoader, source)
    {
    }
    public override IDisposable DeferRefresh()
    {
        return this._suppressDefer ? new NoDefer() : base.DeferRefresh();
    }
    protected override void OnLoadCompleted(object sender, AsyncCompletedEventArgs e)
    {
        this._suppressDefer = true;
        base.OnLoadCompleted(sender, e);
        this._suppressDefer = false;
    }
    private class NoDefer : IDisposable
    {
        public void Dispose()
        {
            // do nothing
        }
    }
}
0
Accepted
Milan
Telerik team
answered on 15 Dec 2010, 08:03 AM

Hi Kyle,

We did investigate this issue further and we identified a problem in our code which we will be fixing. You can track the status of this issue from here.

Thank you for reporting this issue. I have updated your Telerik points.



Best wishes,
Milan
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Tomas
Top achievements
Rank 1
answered on 11 Jan 2011, 08:45 PM

Thank you both Telerik and Microsoft for your support.
We've decided to wait and see what future versions from either company has to offer.

Tomas

0
Richard
Top achievements
Rank 1
answered on 03 Feb 2011, 02:14 AM
I clicked on the link to see what the status of this issue is, but it does not take me to the particular bug report in PITS. Has this been resolved?
If not, how can I track it in PITS?

Thnaks.
Richard
0
Vlad
Telerik team
answered on 08 Feb 2011, 11:05 AM
Hi,

 The issue is still not resolved and it was set to private. I've changed the issue to be public - here is the link:
http://www.telerik.com/support/pits.aspx#/public/silverlight/4351

Regards,
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
Sergey
Top achievements
Rank 1
answered on 10 Feb 2011, 03:49 PM

RadGridView does not work with DomainCollectionView and  DomainCollectionViewWorkaround.

How to reproduce the bug.

1. Take the following samples:
http://cid-9da0e3aa6fc40e75.office.live.com/self.aspx/.Public/DomainCollectionViewSample.zip

http://www.telerik.com/community/forums/silverlight/gridview/the-new-domaincollectionview-and-radgridview.aspx

 

2. Apply the following changes to DomainCollectionViewSample to view/test bug in RadGridView  + RadGridView + DomainCollectionViewWorkaround:

2.2 In client project "DomainCollectionViewSample":
 2.2.1 Add to the project the class DomainCollectionViewWorkaround.cs;
 2.2.2 Add reference to Telerk.Windows.Controls.GridView;
 2.2.3 In MainPage.xaml - change  sdk:GridView to telerik:RadGridView;
 2.2.4 In SampleViewModel.cs - change "this._view = new DomainCollectionView<SampleEntity>(this._loader, this._source);"  to "this._view = new DomainCollectionViewWorkaround<SampleEntity>(this._loader, this._source);"

3. Rebuild "DomainCollectionViewSample" solution;

4.Run app;
 4.1. Switch RadGridView to 2-nd page;
 4.2. Try to sort RadGridView clicking any column header - app will go into endless cycle (set breakpoint in DomainCollectionViewWorkaround.OnLoadCompleted() method.)

0
Adrian Pay
Top achievements
Rank 1
answered on 10 Apr 2012, 04:37 AM
How is this problem going, looks like I am facing the same issue now.

Does Kyle's workaround really work?  thanks
Tags
GridView
Asked by
Tomas
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Kyle
Top achievements
Rank 1
Milan
Telerik team
Tomas
Top achievements
Rank 1
Richard
Top achievements
Rank 1
Vlad
Telerik team
Sergey
Top achievements
Rank 1
Adrian Pay
Top achievements
Rank 1
Share this question
or