icollectionview

Convert Predicate<T> to Expression<Func<T, bool>>

ⅰ亾dé卋堺 提交于 2020-01-01 09:33:14
问题 Is possible to convert a Predicate<T> to Expression<Func<T, bool>> in some way? I would like to use the next IQueryable function using the filters of the my ICollectionView: public static System.Linq.IQueryable<TSource> Where<TSource>(this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<System.Func<TSource, bool>> predicate) Thanks 回答1: In theory it is possible to convert a delegate 'back' to an expression, because you can request the emitted IL of a delegate, which

how to sort ObservableCollection

半城伤御伤魂 提交于 2019-12-28 10:06:25
问题 I have a an ObservableCollection and a WPF UserControl is Databound to it. The Control is a graph that shows a vertical bar for each item of type BarData in the ObservableCollection. ObservableCollection<BarData> class BarData { public DateTime StartDate {get; set;} public double MoneySpent {get; set;} public double TotalMoneySpentTillThisBar {get; set;} } Now I want to sort out the ObservableCollection based on StartDate so that the BarData's will be in increasing order of StartDate in the

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=

CollectionView without a dispatcher

懵懂的女人 提交于 2019-12-25 11:52:28
问题 I need a sorting, grouping and filtering behavior of a CollectionView also with LiveShaping properties, but every .NET implementation has a Dispatcher connected to it. Is there any implementation of the ICollectionView without a dispatcher? 回答1: Is there any implementation of the ICollectionView without a dispatcher? No, there isn't. The only class that implements this interface in the .NET Framework is the CollectionView class and it is a DispatcherObject . So you will have to provide your

CollectionView without a dispatcher

房东的猫 提交于 2019-12-25 11:52:20
问题 I need a sorting, grouping and filtering behavior of a CollectionView also with LiveShaping properties, but every .NET implementation has a Dispatcher connected to it. Is there any implementation of the ICollectionView without a dispatcher? 回答1: Is there any implementation of the ICollectionView without a dispatcher? No, there isn't. The only class that implements this interface in the .NET Framework is the CollectionView class and it is a DispatcherObject . So you will have to provide your

Wpf ICollectionView Binding item cannot resolve property of type object

青春壹個敷衍的年華 提交于 2019-12-21 07:25:21
问题 I have bound a GridView with an ICollectionView in the XAML designer the properties are not known because the entity in the CollectionView have been transformed into type Object and the entity properties can't be accessed, it runs fine no error but the designer shows it as an error, if I bind to the collection I can access the properties fine Example the entity is a Person with a string Name property I place them in an ObservableCollection<Person> and get the view from it and bind it to the

wpf datagrid drag row on Icollectionview which bind to collection

笑着哭i 提交于 2019-12-13 18:31:24
问题 I have a datagrid like this _productsPosition = new ObservableCollectionEx<NotifiedPositionInfo>(); _itemSourceList = new CollectionViewSource() { Source = _productsPosition }; _itemSourceList.Filter += new FilterEventHandler(FilteringProduct); PositionsGrid.ItemsSource = _itemSourceList.View; and when I try to drag row on this datagrid, i can obtain the index of row on the collectionview. But this index can not help me get the same element in the collection _productsPosition, because the

sort and group Icollectionview in WPF

被刻印的时光 ゝ 提交于 2019-12-11 13:17:49
问题 I have created a listview control in WPF and has success fully bound Icollectionview object of ObservableCollection<object> . My listview columns are created dynamically. I have to sort and group my listview and it is not working properly. My code is as below. private void LaodList() { dt = new DataTable(); dt.Columns.Add("AA", typeof(string)); dt.Columns.Add("BB", typeof(string)); dt.Columns.Add("cc", typeof(string)); dt.Rows.Add("12", "66",11); dt.Rows.Add("33", "44",22); dt.AcceptChanges()

Update item in BindableCollection with notify ICollectionView

夙愿已清 提交于 2019-12-11 05:48:45
问题 Hi I bind collection from Caliburn Micro on ListBox control in view. Here is it. public BindableCollection<UserInfo> Friends { get { return _friends; } set { _friends = value; NotifyOfPropertyChange(() => Friends); } } ListBox items is type of UserInfo. Hi I sort and group listbox items, I use CollectioView on this purpose. When I initialize ListBox I sort and group items with this method. private ICollectionView _currentView; //... private void SortContactList() { _currentView =

ICollectionView cancel currentchanging

血红的双手。 提交于 2019-12-11 01:06:31
问题 I am looking for a way to cancel the CurrentChanging event depending on the item that was clicked. In my application I use ICollectionView to hold my list of viewmodels which are rendered as tabitems in a tabcontrol. For a specific viewmodel I need to do some property checking before the viewmodel can be activated. In order to do that I need to now that the specific viewmodel is going to be the next current item. Depending on the results of the property checking, the change of the current