I have an IEnumerable <> that lazy loads data. I just want to set the Combobox ItemsSource element to IEnumerable, but when I do this, it loads all the data anyway (which eliminates the lazy loading point).
I also tried it with Linq-To-Sql, since it looks like a similar theory, and it also loads all the data.
Is there an easy way to do this?
Try setting the IsAsync-Property to ItemSource-Binding ComboBox to True:
<ComboBox ItemsSource={Binding YourItemsSourceProperty, IsAsync=True} SelectedItem={Binding YourSelectionProperty} />
, : http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/3d343489-90c4-4bdc-8bd9-1046ec9daf76 , IList.
PriorityBinding, , .
IEnumerable . ObservableCollection ( .) , - IEnumerable, ( combobox, - .) , ObservableCollection, comboBox.
, WPF ComboBox ItemsSource. , , ?
Items ComboBox .
, IEnumerable lazy , ObservableCollection
foreach(Item i in myIEnumerable) { myObsCol.Add(i); }
.
. , , combobox ( ItemsSource dataItem to SelectedValue/SelectedItem), . Combobox Selector, ItemsSource, , Value/SelectedItem, Selector FindItemWithValue ( ). , . , , .
If you want to make your own custom class that will have a list, you can use the INotifyPropertyChanged interface to let you know that your collection has been modified. Or how to use an ObservableCollection, as already suggested
Source: https://habr.com/ru/post/1746937/More articles:Официальное поддерживающее приложение Android для twitter - androidExplanation of disassembling the simplest program (x86) - cCompiling a one-click application requiring an administrator? - vb.netWhy is this not working? - c ++java looping - declaring a class outside / inside a loop - javaJava code efficiency with primitive types - javaResharper Support for Silverlight Unit Test Application - silverlightAlgorithm for determining the minimum set of coins that you must follow to always make accurate changes - setRails: last three comments with unique users - ruby | fooobar.comHow to change an order in an ordered + saved collection? - javaAll Articles