Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Carousel > Updating carousel when collection changes

Not answered Updating carousel when collection changes

Feed from this thread
  • Posted on May 16, 2011 (permalink)

    I'm binding my carousel to a child collection of an item on my ViewModel. This collection is an EntityCollection, but when I add an item to that bound collection, it's not being reflected in the carousel. It's not picking up the change.

    My bound collection is a child collection to a EF entity object on my viewModel. I've tried capturing the event on my viewmodel and Raising a PropertyChanged on it, but that doesn't work either. My code is being fired, but that isn't updating the carousel. Maybe because I'm raising a propertyChanged, not a collection Changed?

    Reply

  • Maya Maya admin's avatar

    Posted on May 17, 2011 (permalink)

    Hello Rayne,

    I have tried to reproduce the issue you reported, but unfortunately I was not able to. May you take a look at the sample attached to verify whether there is any misunderstandings according to your requirements ?

    Greetings,
    Maya
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Posted on Jun 15, 2011 (permalink)

    In your sample, you are getting the ItemsSource as an IList of Player. Then adding to the list.

    In my code, the binding the button click to a delegateCommand on my viewmodel, that adds a new items to the collection. My VM contains a property that is an EF entity (Complaint). This entity has a child collection (EntityCollection) Photos that I'm binding the carousel to.

    If I put a breakpoint in my code after adding a new item to the bound collection, I can see that the Items Collection of the carousel has only has 4 items and the ItemsSource collection has 5 items. So it's not updating the carousel when I add a new item to the bound collection.

    The selected item is also bound and I was hoping that would sync them up and show the newly added item, but no such luck. The only way I can get it to work is to do this:
    PhotosCarousel.Rebind();
    var items = PhotosCarousel.Items;
    if (items.Count > 0)
    {
      items.MoveCurrentToLast();
      PhotosCarousel.BringDataItemIntoView(items.CurrentItem);
    }

    Reply

  • Maya Maya admin's avatar

    Posted on Jun 20, 2011 (permalink)

    Hi Rayne,

    You may try to wrap your images in an ObservableCollection. Thus RadCarousel will be aware of the changes. I am sending you a sample project using images illustrating how you may add a new image. Another possible solution may be to call Rebind() method of the RadCarousel after the item is added. 
    As for setting the new image as the topmost one, you need to call BrindDataItemIntoView method (just as you did). Setting it as the selected once does not guarantee it will be at the front position.

    Kind regards,
    Maya
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Carousel > Updating carousel when collection changes
Related resources for "Updating carousel when collection changes"

WPF Carousel Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]