
Adam Petaccia
Top achievements
Rank 1
Adam Petaccia
asked on 24 Aug 2010, 07:22 PM
I have a RadCarousel (not RadCarouselPanel) which is sometimes updated from an external source, or via the mouse, etc. What I need to be able to do is be notified that RadCarousel (or its panel) is changing which items are in view, and discover them so that the rest of the UI may update its state accordingly.
What events would I need to bind to in order to accomplish this?
What events would I need to bind to in order to accomplish this?
4 Answers, 1 is accepted
0
Hi Adam Petaccia,
However, in order this mechanism to work, the data for the carousel should implement the INotifyPropertyChanged Interface.
As for discovering the visible items and updating the UI accordingly, I would need more details in order to provide you with an appropriate solution. What exactly are your requirements and expectations for using such a functionality?
All the best,
Maya
the Telerik team
In order to trace a change of the elements in the RadCarousel, you may handle CollectionChanged event of the Items Property:
this.MyCarousel.Items.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Items_Col lectionChanged);
However, in order this mechanism to work, the data for the carousel should implement the INotifyPropertyChanged Interface.
As for discovering the visible items and updating the UI accordingly, I would need more details in order to provide you with an appropriate solution. What exactly are your requirements and expectations for using such a functionality?
All the best,
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
0

Adam Petaccia
Top achievements
Rank 1
answered on 26 Aug 2010, 03:54 PM
I apologize for being ambiguous; to clarify I don't wish to know when a visible item changes, I wish to know when the set of visible items changes. I've implemented my own buttons for manipulating the RadCarousel, and I can use RadCarousel.FindCarouselPanel().LineLeft to move the selection left, but I don't know what item(s) has/have come into focus. Ideally, I'm looking for something that would allow me to write code like this:
From this code I would be able to loop through the objects which have come into view (either because the user scrolled, or adjusted the number of visible items).
RadCarousel.VisibleItemsChanged += (sender, visibleItemsChangedArgs) =>
{
RadCarousel carousel = (RadCarousel)sender;
//...
foreach
(MyObjectType myObject
in
visibleItemsChangedArgs.NewItems)
{
//... update other UI and save state
}
}
0
Accepted
Hello Adam Petaccia,
I am sending you a sample project illustrating the proposed solution.
All the best,
Maya
the Telerik team
You may try to use the property of the RadCarouselPanel - Children - which will provide all visible elements.
So, for example the RadCarouselPanel can be found by the FindCarouselPanel method and then its corresponding property Children:
private void RadButton_Click_1(object sender, RoutedEventArgs e)
{
RadCarouselPanel panel = this.MyCarousel.FindCarouselPanel() as RadCarouselPanel;
MessageBox.Show("The number of children is: " + panel.Children.Count);
}
I am sending you a sample project illustrating the proposed solution.
All the best,
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
0

Adam Petaccia
Top achievements
Rank 1
answered on 17 Sep 2010, 08:57 PM
Sorry for the late response, that solution is indeed exactly what I was looking for. I didn't know it would be as simple as looking at children! ( I had thought it would show everything that _could_ be displayed).