DataBoundListBox seems don't works

4 posts, 0 answers
  1. Paul
    Paul avatar
    2 posts
    Member since:
    Mar 2014

    Posted 04 Mar 2014 Link to this post

    Hi I've  downloaded and install telerik Ui for Windows phone 8 (trial version), so I'm really interested into DataBoundListBox,
    but I've try with this code and don't works as aspected,
    I think that at the end of scroll  collection_ItemsLoading should be called, but after fill collection at the beginning nothing happen and event never raise anymore.


    VirtualizingDataCollection collection = new VirtualizingDataCollection(30, 10);
    public MainPage()
    {
                InitializeComponent();

                radDataBoundListBox.DataVirtualizationMode = DataVirtualizationMode.Automatic;
                collection.ItemsLoading += new EventHandler<VirtualizingDataCollectionItemsLoadingEventArgs>(collection_ItemsLoading);
                radDataBoundListBox.ItemsSource = collection;

                
                
            }

            void collection_ItemsLoading(object sender, VirtualizingDataCollectionItemsLoadingEventArgs e)
            {
                
                collection.LoadItems(e.StartIndex, GetNext(e.Count));
            }

           

            int _item = 0;

            IEnumerable<string> GetNext(int n) {

                var l = new List<string>();
                for(var a=0;a<n;a++,_item++)
                    l.Add("ITEM"+_item);

                return l as IEnumerable<string>;
            
    }


    thanks
  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 04 Mar 2014 Link to this post

    Hi Paul,

    Thanks for writing.

    Based on the source code you are pasting we cannot exactly say what happens. The VirtualizingDataCollection simply tracks which scroll position are you at and requests that all visible items are initialized for that scroll position. If your visual items are small enough that they all fit in the DataBoundListBox''viewport - they will all be loaded at once in the beginning and you will not receive any further ItemsLoading events.

    Anyway, if you share with us your project in a separate support ticket we will be able to inspect your code and see how we can further assist you.

    Regards,
    Deyan
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
  3. DevCraft banner
  4. Paul
    Paul avatar
    2 posts
    Member since:
    Mar 2014

    Posted 04 Mar 2014 in reply to Deyan Link to this post

    Thanks for the answer,
    my source is already here, only I left xaml part, a simple declaraction of a radDataBoundListBox, bytheway I understand that don't works as I understood..
    To solve my problem I need  a listbox which display a list of items always constantly filled with 50 values, to achive this I should raise an event, when last item into listbox is displayed, but my list virtually never end because is costantly filled.
    I thought DataBoundListBox did this :)

      
  5. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 04 Mar 2014 Link to this post

    Hi Paul,

    Then you may want to take a look at our Data Virtualization feature documented here:

    http://www.telerik.com/help/windows-phone/raddataboundlistbox-features-datavirtualization-overview.html

    There are several data virtualization modes which you can choose from. I think you should be looking at the OnDemand* features.

    Let us know if you have additional questions.

    Regards,
    Deyan
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
Back to Top
DevCraft banner