VirtualQueryableCollectionView CurrentItem not loaded

4 posts, 0 answers
  1. jura
    jura avatar
    7 posts
    Member since:
    Feb 2007

    Posted 19 Aug 2015 Link to this post

    While using RadGridView with VirtualQueryableCollectionView and moving CurrentPosition with any of MoveCurrent* methods, I have found, that CurrentItem is not loaded when CurrentPosition changes to an index of not yet loaded item (in my case LoadSize is 50 and items are loaded from our WCF service) and thus CurrentItem is null.
    The problem is in QueryableCollectionView.InternalGetItemAt where

    return this.InternalList[index];

    ignores items loading.

     

    My fix for now is:

    public class VirtualQueryableCollectionView<T> :
            Telerik.Windows.Data.VirtualQueryableCollectionView<T>
        {
            protected override void OnCurrentChanged(EventArgs args)
            {
                // fix not loaded CurrentItem is not loaded when CurrentPosition changes
                if (
                    !IsCurrentBeforeFirst &&
                    !IsCurrentAfterLast &&
                    CurrentItem == null
                    )
                {
                    SetCurrent(GetItemAt(CurrentPosition), CurrentPosition);
                }
                base.OnCurrentChanged(args);
            }
        }

    It has a drawback that OnCurrentChanged is called twice when this fix is effective.

  2. jura
    jura avatar
    7 posts
    Member since:
    Feb 2007

    Posted 19 Aug 2015 in reply to jura Link to this post

    I forgot to mention that I am Marek Ištvánek using Jura`s account ;-)
  3. UI for WPF is Visual Studio 2017 Ready
  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 24 Aug 2015 Link to this post

    Hi,

    You are indeed right. The MoveCurrent methods are not respected by VirtualQueryableCollectionView.

    In order to get better overview on what the progress of this issue is, I would suggest you to submit it on the Feedback Portal. You can also refer to the details posted at the end of this reply. That way you may follow the item and get notified when there is a change in the status of the report. 

    Thank you for sharing the workaround you came up with the community.

    Regards,
    Dimitrina
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. jura
    jura avatar
    7 posts
    Member since:
    Feb 2007

    Posted 24 Aug 2015 Link to this post

    Reported here:
    http://feedback.telerik.com/Project/143/Feedback/Details/167237-virtualqueryablecollectionview-currentitem-not-loaded

    Marek

Back to Top