icollectionview

Mock data not showing when bound to ICollectionView

我的梦境 提交于 2019-12-02 09:36:09
问题 If I bound my ListBox to ViewModels ObservableCollection or XAML resourced CollectionViewSource , the mock data shows while in design. Sometimes CollectionViewSource stops showing this data because of some XAML changes, but after rebuilding the code it fills controls back with fake data again. Grouping, sorting and filtering in my case are controlled in ViewModel (and retried from database) so I decided to move over to ICollectionView property based in ViewModel. Unfortunately Views are no

CollectionView.DeferRefresh() throws exception

微笑、不失礼 提交于 2019-11-30 20:03:06
There are cases when you have many UI updates due a massive amount of INotifyChangedProperties events. In that case you might want to signal the changes to UI only once when all the properties are set like in a batch. I found this great article that explains how to defer the refresh of the ViewCollection: http://marlongrech.wordpress.com/2008/11/22/icollectionview-explained/ However I get an exception when the View is deferred and I try to add something to the collection. I don't understand why this shouldn't be allowed. That's the whole point of it in first place. InvalidoperationException:

CollectionView.DeferRefresh() throws exception

做~自己de王妃 提交于 2019-11-30 04:23:34
问题 There are cases when you have many UI updates due a massive amount of INotifyChangedProperties events. In that case you might want to signal the changes to UI only once when all the properties are set like in a batch. I found this great article that explains how to defer the refresh of the ViewCollection: http://marlongrech.wordpress.com/2008/11/22/icollectionview-explained/ However I get an exception when the View is deferred and I try to add something to the collection. I don't understand

Arrow keys don't work after programmatically setting ListView.SelectedItem

孤街醉人 提交于 2019-11-29 02:03:33
I have a WPF ListView control, ItemsSource is set to an ICollectionView created this way: var collectionView = System.Windows.Data.CollectionViewSource.GetDefaultView(observableCollection); this.listView1.ItemsSource = collectionView; ...where observableCollection is an ObservableCollection of a complex type. The ListView is configured to display, for each item, just one string property on the complex type. The user can refresh the ListView, at which point my logic stores the "key string" for the currently selected item, re-populates the underlying observableCollection. The previous sort and

Automatically refresh ICollectionView Filter

孤者浪人 提交于 2019-11-28 20:34:19
问题 Is there any way to automatically update a filter on an ICollectionView without having to call Refresh() when a relevant change has been made? I have the following: [Notify] public ICollectionView Workers { get; set; } The [Notify] attribute in this property just implements INotifyPropertyChanged but it doesn't seem to be doing anything in this situation. Workers = new CollectionViewSource { Source = DataManager.Data.Workers }.View; Workers.Filter = w => { Worker worker = w as Worker; if (w =

Arrow keys don't work after programmatically setting ListView.SelectedItem

南笙酒味 提交于 2019-11-27 16:23:06
问题 I have a WPF ListView control, ItemsSource is set to an ICollectionView created this way: var collectionView = System.Windows.Data.CollectionViewSource.GetDefaultView(observableCollection); this.listView1.ItemsSource = collectionView; ...where observableCollection is an ObservableCollection of a complex type. The ListView is configured to display, for each item, just one string property on the complex type. The user can refresh the ListView, at which point my logic stores the "key string" for

Fast performing and thread safe observable collection

早过忘川 提交于 2019-11-26 15:54:28
ObservableCollection s raise notifications for each action performed on them. Firstly they dont have bulk add or remove calls, secondly they are not thread safe. Doesn't this make them slower? Cant we have a faster alternative? Some say ICollectionView wrapped around an ObservableCollection is fast? How true is this claim. ObservableCollection can be fast, if it wants to. :-) The code below is a very good example of a thread safe, faster observable collection and you can extend it further to your wish. using System.Collections.Specialized; public class FastObservableCollection<T> :

Fast performing and thread safe observable collection

ⅰ亾dé卋堺 提交于 2019-11-26 04:39:28
问题 ObservableCollection s raise notifications for each action performed on them. Firstly they dont have bulk add or remove calls, secondly they are not thread safe. Doesn\'t this make them slower? Cant we have a faster alternative? Some say ICollectionView wrapped around an ObservableCollection is fast? How true is this claim. 回答1: ObservableCollection can be fast, if it wants to. :-) The code below is a very good example of a thread safe, faster observable collection and you can extend it