Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseFor some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
CloseRaised when the data source of a vertical collection view is assigned a new reference or new type.
Use this event to handle changes to the vertical collection view's data source, ensuring the UI appropriately
reflects the new data. For example, if the data source changes from a list of characters to a list of items, you can
use this event to update the binding events so the UI fits the new type.
This event isn't raised if the selection or the size of the data source changes. For size changes, such as adding
or removing an item from a list view, listen to the BaseListViewController.itemsSourceSizeChanged event.
For selection changes, listen to the BaseVerticalCollectionView.selectionChanged event.
Additional resources: BaseListViewController.itemsAdded, BaseListViewController.itemsRemoved
The following example illustrates that the itemsSourceChanged
event is only triggered when the itemsSource property is changed,
not when the contents of the data source are modified.
var changedCount = 0; var source = new List<string>(); var listView = new ListView(); listView.itemsSourceChanged += () => changedCount++; // Changing the data source of the list view triggers the event. listView.itemsSource = source; // Adding an item to the source doesn't trigger itemsSourceChanged // because the data source reference remains the same. source.Add("Hello World!"); // Adding an item to the ListView directly doesn't trigger itemsSourceChanged // because the data source reference remains the same. listView.viewController.AddItems(1); Debug.Log(changedCount); // Outputs 1.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.