Lazy Download wpf Combined Items

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?

+3
source share
6 answers

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, , .

+3

IEnumerable . ObservableCollection ( .) , - IEnumerable, ( combobox, - .) , ObservableCollection, comboBox.

+2

, WPF ComboBox ItemsSource. , , ?

+1

Items ComboBox .

, IEnumerable lazy , ObservableCollection

foreach(Item i in myIEnumerable)
{
    myObsCol.Add(i);
}

.

+1

. , , combobox ( ItemsSource dataItem to SelectedValue/SelectedItem), . Combobox Selector, ItemsSource, , Value/SelectedItem, Selector FindItemWithValue ( ). , . , , .

+1

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

+1
source

Source: https://habr.com/ru/post/1746937/


All Articles