collectionviewsource

WPF Multiple CollectionView with different filters on same collection

夙愿已清 提交于 2019-12-28 08:08:11
问题 I'm using a an ObservableCollection with two ICollectionView for different filters. One is for filtering messages by some type, and one is for counting checked messages. As you can see message filter and message count works OK, but when I'm un-checking the message disappear from the list ( the count is still working ). BTW sorry for the long post, I wanted to include all relevant stuff. The XAML Code: <!-- Messages List --> <DockPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Height=

DataGrid grouping doesn't update on change in CollectionViewSource

天大地大妈咪最大 提交于 2019-12-25 05:08:12
问题 I have a CollectionViewSource CollectionOfVideos bound to ObservableCollection ListOfVideos . That CollectionViewSource is the ItemsSource for the DataGrid dataGrid_Video . I've implemented a grouping by lShortName of label of ListOfVideos . When items are added to DataGrid, grouping seems to work, because it groups all added items by their default label . Problem is, grouping doesn't update when label of item is changed. Here's my code: Window.Resources in MainWindow.xaml

Binding to a CollectionViewSource Question

≯℡__Kan透↙ 提交于 2019-12-25 01:55:50
问题 My issue goes like that: I have 2 ListBox: one is bound to a collection called photos of type Photos and the other is bound to a CollectionViewSource which is bound to the same photos collection. listBox1 -> photos (here the listBox1 is bound to the Default CollectionView of photos, of course and not directly to photos.) ListBox2 -> cvs -> photos both collection (the default one and my CVS) having a filter that reduce the items they show from 8 items to 5 items. now i have 2 labels. one is

wpf mvvm threading.Timer and TimerCallback problems

℡╲_俬逩灬. 提交于 2019-12-25 00:42:26
问题 I have a WPF application developed against the MVVM framework in which the ViewModel constructor set a Timer with a TimerCallback. The TimerCallback retrieves an ObservableCollection and passes it to a field on the VM. I have a CollectionViewSource which has its Source property set to the ObservableCollection. I am using a CollectionViewSource because I want to enable filtering on the Collection. I have found that when the TimerCallback attempts to pass the ObservableCollection into the local

How can I bind DataGrid row count after a CollectionView filter is applied?

本小妞迷上赌 提交于 2019-12-24 00:52:10
问题 Previously to implementing filtering on the CollectionView, i used this to display the number of rows within the datagrid; <TextBlock Text="{Binding ElementName=dataGrid1, Path=ItemsSource.Count}" /> I have since implemented a filter as so; ICollectionView cvs = CollectionViewSource.GetDefaultView(datagrid1.ItemsSource); cvs.Filter = new Predicate<object>(FilterMethod); ... public bool FilterMethod(object item) { // conditionally returns true/false } The TextBlock above still shows the

Filtering CollectionViewSource

一笑奈何 提交于 2019-12-24 00:07:40
问题 I want to make a ComboBox bound to my data, with a filter . For that I've created a TextBox and a ComboBox . In the code behind I read a file and generate objects of class Channel that are stored as items of the ComboBox . Although the compiler throws no error the filtering doesn't work properly. If I write something the data is gone, if I erase, it's back. After trying and trying I've realized that if I started typing "myNamespace.myChannel" (Unico.Canal) the data remained, but don't filter.

How to Sort a LongListSelector using CollectionViewSource

帅比萌擦擦* 提交于 2019-12-22 18:48:07
问题 I have a LongListSelector that is currently being populated with images from IsolatedStorage . I would like be able to sort these by date in ascending or descending order. I have been referencing http://babaandthepigman.wordpress.com/2011/07/03/wp7-collectionviewsource-sorting-a-listbox/ for assistance. For some reason, I have having trouble binding the ItemsSource of my LongListSelector to the CollectionViewSource to implement the sort feature. PictureRepository.cs (to load the pictures from

How to Sort a LongListSelector using CollectionViewSource

不羁岁月 提交于 2019-12-22 18:47:10
问题 I have a LongListSelector that is currently being populated with images from IsolatedStorage . I would like be able to sort these by date in ascending or descending order. I have been referencing http://babaandthepigman.wordpress.com/2011/07/03/wp7-collectionviewsource-sorting-a-listbox/ for assistance. For some reason, I have having trouble binding the ItemsSource of my LongListSelector to the CollectionViewSource to implement the sort feature. PictureRepository.cs (to load the pictures from

Custom sorting logic for groups using CollectionViewSource

我是研究僧i 提交于 2019-12-22 08:16:15
问题 I have a list of "stuff" which needs to be filtered then displayed in a grouped and sorted manner. The data needed to calculate the grouping and sorting order is not available as simple properties - there needs to be some work done in code to calculate the order and groups. CollectionViewSource lets me define custom filter and sort logic - so far so good. It also lets me bind GroupDescriptions to a value converter so that I can generate the group names. The last thing I want to do is control

CollectionViewSource sorting only the first time it is bound to a source

拥有回忆 提交于 2019-12-20 11:37:05
问题 I'm using a DataGrid bound to a CollectionViewSource ( players ), itself bound to the currently selected item of a ListBox ( levels ), each item containing a collection to be sorted/displayed in the DataGrid: <ListBox Name="lstLevel" DisplayMemberPath="Name" IsSynchronizedWithCurrentItem="True" /> ... <!-- DataGrid source, as a CollectionViewSource to allow for sorting and/or filtering --> <CollectionViewSource x:Key="Players" Source="{Binding ElementName=lstLevel, Path=SelectedItem.Players}"